0
Fixed

Error when getting scene variable during On Enable (1.4.0b1)

Real World 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 5

In Bolt 1.4 the way you get the current scene has changed from 

owner.GameObject().scene

to

flow.stack.scene

This seems to have introduced a problem for us. We have an embed state graph in the scene. Each state in this graph is a macro. One of these macros gets a scene variable. In the graph view, the drop down finds the scene variables correctly and offers suggestions but at run time we get a null reference exception because (I believe) the scene is null

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

Hm, I see there could be an issue there, but I can't isolate it from your description.

Can you send me:

1) A minimal setup / graph that reproduces the issue (1 embed graph with 1 macro state, for instance)

2) The stack trace of the error that happens at runtime

Thank you for your in-depth testing, by the way! :)

You're welcome. This should be enough to reproduce it. Let me know if not. Testing.zip

Working on Fix

Found the cause of the issue. Bolt doesn't recognize the scene during OnEnable because it isn't fully loaded yet. Will try a simple fix!

+1
Fixed in Beta

Seemingly working fix ready for beta 2, although I'm unsure yet whether it will have side effects.