Forum rules - please read before posting.

Animation resets on load.

I have a custom player animation where he climbs a stack of crates and when the animation reaches the last frame it stays there not returning to idle. From here he can then interact with the scene and doesn't return to his idle animation until he decends the crates.

My problem is, when he is on top of the crates and I save the game, reloads the scene, then the animation state is forgotten and he's back in his idle animation, although gameplay-wise he's still on the crate.

I've tried adding a 'remember animator' to the player prefab, but that doesn't help. Any ideas how this is resolved?

Comments

  • What "Animation engine" does your character use, and can you share a screenshot showing their Animator Controller?

    Rather than staying on the last-frame of the climbing animation, try transitioning to a separate animation that's just the last-frame of that one in a loop.

  • Animation engine is 'Sprites Unity'. I actually already have tried putting in a looping idle, as part of my trouble shooting, but it doesn't help the problem.

    Here is an image of the animation controller, the 3 circled nodes are the one being used in this case:
    https://imgbox.com/Wx0Smz74

  • edited December 2023

    What are your Unity/AC versions?

    Assuming you're using the latest, open up AC's Player.cs script and look for the following on line 1033:

    ForceIdle ();
    

    Replace it with:

    if (!playerData.inCustomCharState) ForceIdle ();
    

    Does that resolve it? If so, you may be able to do away with the extra "idle" animation.

  • Unity is 2022.3.4f1 and AC is up to date.
    Editing the script didn't do anything.

  • Do the same thing for the same lines further down inside the two "else" blocks, around line 1072 / 1078.

  • Hmm, it halfway solved it. So if the player climbs the crates and I save, then load, it works he's on the crates. But if I save with him on the crates and then climbs down before loading, then when I load the scene he is on the ground.

  • I could recreate the earlier issue, but not this one.

    Does the animation itself change the position of the root or sprite child, and are you forcing the Player back to their Idle state after climbing down?

    Lets see screenshots of the Actions involved (both climbing up and down) as well as the contents of the "Player data" section for the save file - accessed from the Save-game file Manager.

  • edited December 2023

    No I'm not doing anything with the root or sprite child, it's just a plain animation.
    Yes the climbdown animation returns to idle at the end.
    Here are screendumps of the actionlist and date from the savefile:

    https://imgbox.com/N6YLL7i5
    https://imgbox.com/JWCHCwSZ

  • No I'm not doing anything with the root or sprite child, it's just a plain animation.

    When the Player is on the ground, then, is that to say they're playing their regular "Idle" animation, as though nothing was loaded at that point?

    I may need you to PM me the files involved to recreate this. The scene, Player prefab, animation/graphic assets and Managers ought to be enough.

  • Yes, on the ground I mean the regular Idle animation.
    I've sent you a PM with a dropbox link for the scene in question.

  • Two things needed:

    • Remove the Remember Animator on the root, leaving just the one on the sprite child
    • On the latter, check "Retain in prefab?"
  • Thanks Chris, appreciate it!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.