Forum rules - please read before posting.

Remember Animator and Visibilitywith Player Prefabs and Players in scene

I'm using animation parameters and Remember Visibility scripts on sprite renderers to allow the player to customise a character - things were going fine, but now the animation parameters I assign in my character selection scene (to an in-scene player prefab) aren't staying around when I switch to my first game scene. It was working as intended for a short while, and save files made during this period still load up with their customisations intact.

The setup is as follows:

  • Player Prefab in scene
    • Sprite Child with Animator component, remember animator (set to save changes in controller) and automatically assigned constant ID
    • Customisable parts of the multipart Player prefab have remember visibility set to save colour
  • Unity UI in the scene changes an animation parameter int (via AC) that turns on the various customisable components.

Works fine in the setup scene, but when AC creates my player prefab in the next scene, animator has reset to default values - the colour remains as chosen however.

Anything obviously wrong-headed or broken about the setup?

EDIT: After auto-assigning saves to objects, the colour resets to default too.

Comments

  • Additional info:

    the little bit of debug code from here:

    https://adventurecreator.org/forum/discussion/8108/need-help-with-remember-animator-and-loading

    doesn't fire at all - indicating that the remember script is just not executing?

  • More:

    Realise I misunderstood the debug code - it wouldn't print to the console on a scene transition, so disregard that.

    I have colour remembering back; removing an autosave before the scene transition did that. However, saving and loading remembers neither colour nor animation parameters.

    I'm stumped!

  • A local Player in your scene is treated separately to the "default" one that is spawned into scenes that have no local Player. Any data associated with one is independent of the other.

    To have such changes be applied to your default Player, you would either have to remove the local Player entirely (so that the default is the only one ever active), or - through scripting - transfer the saved Remember data from the local Player to the default Player once the new scene is loaded.

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.