Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Creating E-Learning Games with Unity
  • Table Of Contents Toc
  • Feedback & Rating feedback
Creating E-Learning Games with Unity

Creating E-Learning Games with Unity

By : David Horachek
4.4 (10)
close
close
Creating E-Learning Games with Unity

Creating E-Learning Games with Unity

4.4 (10)
By: David Horachek

Overview of this book

Table of Contents (17 chapters)
close
close
Creating E-Learning Games with Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

Using delete/load patterns


Having planned how to organize our GameObjects into globally persistent and level-specific lifespans, we must further update GameMgr.cs to ensure that only the current level is loaded at any time. To do this, perform the following steps:

  1. In GameMgr.cs, inside the ChangeState() method, the first thing we do is tell the game to delete any potential level-specific GameObject hierarchies that may be loaded:

    if (GameObject.Find("_level1")
      Destroy (GameObject.Find ("_level1"));
    if (GameObject.Find("_level2")
      Destroy (GameObject.Find ("_level2"));
    if (GameObject.Find("_level3")
      Destroy (GameObject.Find ("_level3"));
  2. Inside the switch statement that ChangeState() implements, we signal a LoadLevelAdditive() call when changing to LEVEL1, LEVEL2, or LEVEL3. However, when switching to MAIN, we simply need to destroy the _level1, _level2, and _level3 GameObjects since _global remains persistent throughout.

  3. Recall that each level-specific scene file must be constructed according...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Creating E-Learning Games with Unity
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon