Not a Bug

scene inaccessible from macro

Nathan Huebner 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 2

1. Create an Embedded Macro.

2. Reference a "Scene" Game Object in anything where you can select a Game Object as a default value.

3. Convert the Macro. 

4. Save it.

5. Save your scene / project.

6. Reload the scene and/or project.

7. The Flow Macro (file) no longer has access to the scene.

8. Clicking to re-target the Game Object only gives you access to "Assets" - Not Scene.

My Workaround:

Create a scene variable, with the name of the Game Object I want accessible from non-embedded macros, and store the Game Object in this variable (as its value) and access it from my saved Flow Macro using "Get Scene Variable".

I understand maybe because the context of the non-embedded flow macro is no longer in the scene, it doesn't have access to the scene, but if that's the case it shouldn't have access to Scene Variables either.  Hopefully this can be fixed.

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

There is the API that can access specific scenes scene variables,  you just won't get the beauty of a auto fill drop down. Not sure exactly how it works in Unity's side, but maybe you can't access all that information from a scene without it being active (talking editor side for drop downs).

I'd lean more that way if I were you. Seems way too hacky to do that constantly. But Lazlo always has some clever idea no one's thinking of.

Would be nice to add a scene selection of some sort.

Not a Bug

Hi Nathan,

That's not a bug, it is how Unity works: objects that are stored outside scenes (ScriptableObjects, like macros) cannot refer to objects within scenes (GameObjects, components, etc.). For example, you can't refer to a scene object in a prefab field. There is nothing I can do to "fix" this, it is by design in Unity.

The correct approach here is indeed to use the variables system, either with an Object variable or a Scene variable.

Macros can conceptually access scene variables because the variable reference is just a name string. It will fetch the value at runtime, when needed, from the current scene in which the macro is instantiated.