Animator Savers

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
younglion27
Posts: 3
Joined: Tue Mar 07, 2023 3:11 pm

Animator Savers

Post by younglion27 »

Hi all,
I don't know what I'm doing wrong but I am having no luck with the animator saver component. It appears as if it has no function because I have setup every possible scenario I can think of but every time I test it, the animator always reverts to the default state. Sometimes it seems to work but it's not consistent.

Here's my scenario. I have a switch/lever to activate a floor object's animator to trigger the "open" animation state. I have setup the animator saver component to both the switch and the floor objects since the floor needs to stay open and the lamp switch needs to stay activated (in it's animation state).

What specifically does the animator saver component save? I have tried both methods of playing the state of the animation and using a bool parameter to transition between states. Neither of which the animator saver seems to remember.

Any help would be appreciated.
Thanks.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Savers

Post by Tony Li »

Hi,

AnimatorSaver saves the state that's currently playing in each layer and how far along the animation is. It also saves the values of all bool, float, int, string, and trigger parameters.

Have you assigned a unique Key value to your AnimatorSaver? The Key should be unique across all savers in all scenes.

If you're sure the Key is unique, make sure you're changing scenes using one of these methods or loading a saved game using the save system. If that all checks out, check if any other scripts are undoing what the AnimatorSaver has just restored.
younglion27
Posts: 3
Joined: Tue Mar 07, 2023 3:11 pm

Re: Animator Savers

Post by younglion27 »

Thanks for your quick reply!

I have assigned a unique key and changed it a few times to make sure it's not the same as any other. I've also left the key blank to allow the auto placement of the game object name (if I understand that correct).

I am using the save system as a sort of checkpoint using "save slot" method. Then reloading from that same save slot as load from slot method.

I'm sure the saving works because the player position and all acquired inventory data save just fine. However, the animator saver just seems to get ignored for some reason. I can't think of anything that would override it. I've typically tried to use the saver for opened gates and activated switches in my game, but in most cases had to resort to the destructible saver (after a gate is opened) to get it to work.

I am using unity visual scripting for most of my logic, though I can't imagine that would interfere with the animator component which I believe the saver is working with.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Savers

Post by Tony Li »

Is there a variable in your visual scripting setup that, for example, keeps track of whether the gate is open or closed? If so, is your visual scripting graph using this variable to manipulate the animator, perhaps overriding the AnimatorSaver's changes?
younglion27
Posts: 3
Joined: Tue Mar 07, 2023 3:11 pm

Re: Animator Savers

Post by younglion27 »

The object levers/switches have an active/inactive bool variable. But The visual scripting logic on the objects don't have a start or update function, everything is being driven by event triggers. So I can't imagine how it would override what the animator is doing.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animator Savers

Post by Tony Li »

Feel free to send a reproduction project to tony (at) pixelcrushers.com. Please include reproduction steps, such as which scene to load, what to do when the scene is loaded, etc.
Post Reply