Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Animator.Rebind() Resets all state, is there another way to change Skeleton?

Discussion in 'Scripting' started by tmcsweeney, Jul 22, 2014.

  1. tmcsweeney

    tmcsweeney

    Joined:
    May 24, 2011
    Posts:
    20
    For complicated reasons involving ragdoll blending I want to instantiate a new copy of a mesh's skeleton and then change the Animator component over to start updating the new skeleton instance while leaving the SkinnedMeshRenderer still reading from the old skeleton.

    Animator.Rebind() looks like it should do the ticket, but unfortunately calling it also resets EVERYTHING on the animator. It jumps back to time=0.0 on the default state and all animation parameters are reset back to their default values. This causes a massive glitch in the animation and undermines the seamless transition I'm trying to achieve.

    I know from experimentation that it is possible to seamlessly change which skeleton a SkinnedMeshRenderer is using by writing (carefully) to the RootBone and Bones[] properties, does anyone know if the same is possible with the Animator component?
     
    StasUnity97 and Hooshangi-reza like this.
unityunity