Loading Objects in Saved Animator State
Posted: Mon Oct 01, 2018 6:28 pm
Hey Toni,
We upgraded to 2.0 and are having some issues figuring out which component to add to an object to preserve its current animator bool state across loading.
For Example:
We have a statue sprite with a light on and it begins with the bool "Lit" set to true. When you attack the statue, the bool becomes false. After saving and loading, the statue's animator bool "Lit" goes back to being true. Is there a way to preserve this value change after loading?
Our current workaround is to create 2 objects, one a parent of the other. The unlit version of the sprite is on the bottom sorting layer and is the parent of the gameobject with the lit sprite, which is on top (as a child). We then added a collider to both objects but turn the lit one off and turn the unlit one on with a sequence. This works because of the Persistent Destructible, because in this scenario, we are disabling a gameobject (the on-top lit sprite) but this would be rather tedious for each and every object that needs to have a persistent animator state across loading.
Would you perhaps know of a simpler way to handle this situation?
Thank you.
-Nik
We upgraded to 2.0 and are having some issues figuring out which component to add to an object to preserve its current animator bool state across loading.
For Example:
We have a statue sprite with a light on and it begins with the bool "Lit" set to true. When you attack the statue, the bool becomes false. After saving and loading, the statue's animator bool "Lit" goes back to being true. Is there a way to preserve this value change after loading?
Our current workaround is to create 2 objects, one a parent of the other. The unlit version of the sprite is on the bottom sorting layer and is the parent of the gameobject with the lit sprite, which is on top (as a child). We then added a collider to both objects but turn the lit one off and turn the unlit one on with a sequence. This works because of the Persistent Destructible, because in this scenario, we are disabling a gameobject (the on-top lit sprite) but this would be rather tedious for each and every object that needs to have a persistent animator state across loading.
Would you perhaps know of a simpler way to handle this situation?
Thank you.
-Nik