Pending Review

Variables API docs update

macguffin 4 years ago updated by Lazlo Bonin (Lead Developer) 4 years ago 2

Hi was looking at this page



Is this now?


You do mention that the API will change and wondered if this is now the correct way to get a Scene variable.

Many thanks


Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

The way Scene variables are stored and accessed changed in the most recent version to accommodate additive scene loading.

You actually have a choice of:

        public static VariableDeclarations ActiveScene { get; }

        which will return the variables for the "active" scene (SceneManager.GetActiveScene()), but that may not always be the scene that you want when using additive, so you can also use:

        public static VariableDeclarations Scene(Scene scene);
        public static VariableDeclarations Scene(GameObject go);
        public static VariableDeclarations Scene(Component component);

Which allow you to get the variables from a specific loaded scene by providing a source for one of the other loaded scenes.  

Pending Review

Yep, thanks for the reminder, I'll update the documentation page soon.