0
Answered

Cannot use Unity object variable references in saved variables: is there a workaround?

Alessandro 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

On my current game I have 2 aot lists as saved variables, one for the objects to be spawned, the other for the objects that can be unlocked.

Once unlocked, an object will move from one list to the other and I need the status of these lists to be saved once the game quits, but I get the note in the subject line about about not being able to use game objects references in saved variables.

Is there a workaround?

Bolt Version:
1.4.0f11
Unity Version:
2018.2.16
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by Alessandro 2 years ago
Answered

That's just the nature of saving in Unity: you can never save object references in any save data, Bolt or not. You would have to store something like a unique ID that you can then map to your actual object after loading.