Immortal objects

By default, Unity regards every object as existing within the self-enclosed time and space of a scene. The difference between scenes is like the difference between separate universes. Consequently, objects don't survive outside the scene to which they belong; this means that they die whenever the active scene changes. This is typically how you want objects to behave, because scenes are usually very different and separate from one another. However, even so, there will be objects that you don't want destroyed. There will be objects that you need carried over between scenes, such as the Player character, a high-score system, or a GameManager class. These are normally high-order objects whose existence shouldn't be limited to specific ...

Get Mastering Unity Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.