Search code examples
unity-game-engineunity3d-2dtools

How do I access booleans from another scene?


I have a script called dataSheet attached to the GameObject DataSheet. How do I access booleans in it from another scene?


Solution

  • When you load a new scene, Unity destroys all objects of the old scene before it creates the objects of the new scene.

    You have to mark objects from the previous scene by calling DontDestroyOnLoad()

    Source

    But this is not right approach how to work with Unity