Object variables on prefab instances reset when assigned from the variables window

Lazlo Bonin (Lead Developer) 4 years ago updated 4 years ago 10

The current workaround seems to be setting the variables directly from the variables component inspector instead of the variables window.

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

when I add a variables and Select one type  ,then  do not write anything 

Select another obj and come back 

you can see the variables resetting

That is normal, and that's not the issue related to this bug report.

In what you're talking about, only the type resets. This bug refers to the whole variable disappearing, or its value resetting.

Basically, what you're seeing is how Bolt variables handle null values. If you give a variable a type that allows null (for example GameObject), then leave that value at null (for example None), all that is saved is that this variable is Null, not that this variable is a Null GameObject, because both are equivalent.

(In programmer terms: Bolt variables are not type safe, so there is no way to serialize the type for a null value).


After some quick testing on Unity 2017.2, I believe this issue is only happening on Prefab Object variables.  If you set an object variable on a prefab and don't click "Apply" on that prefab, then it resets the prefab on play and removes the variable.


I can confirm that variable added from variable window on a prefab disappears on play. Clicking "apply changes" for prefab, just after adding variable, fixes that issue.


It seems you're right, I've been able to reproduce and I'll investigate further.


Hi, Just running through the Bolt Platformer Tutorial and hitting this bug. The speed variable disappears and hence cannot move the player on first play :(

But, I also just wanted to add that this bugs affects *removing* variables from the variables window too. I tested by creating a Boolean variable on the Variable component - all OK when enter play mode. Then, I removed the variable in the variables window, hit play, and BOINK - it's back again...

Fixed in Alpha

Finally, I think I got it fixed for next version! Had to use this obscure method: