0
Pending Review

Variables API docs update

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

Hi was looking at this page

https://support.ludiq.io/forums/4-bolt-manual/topics/414-variables-api/

Variables.Scene

Is this now?

Variables.ActiveScene


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


Many thanks

Matt

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
+1

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.  

+1
Pending Review

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