I have a character in my scene with multiple animations attached. By default in the scene he is in the idle position.
I now want to edit other objects and line them up with his other animations (e.g. place a chair based on his sitting animation). Is there a way I can change him to be in his other animations while I have another object selected?
When I change his animation it works, but as soon as I select another object he switches back to the initial idle position.
The script is attached to only one of the animations!
void Start()
{
GetComponent<Animator>().runtimeAnimatorController =
GameObject.Find("NotMovingCharacter").GetComponent<Animator>().runtimeAnimatorController;
}
void Update()
{
if(GetComponent<Rigidbody2D>().velocity.magnitude > 0f)
{
GetComponent<Animator>().runtimeAnimatorController =
GameObject.Find("MovingCharacter").GetComponent<Animator>().runtimeAnimatorController;
}
if(GetComponent<Rigidbody2D>().velocity.magnitude == 0f)
{
GetComponent<Animator>().runtimeAnimatorController =
GameObject.Find("NotMovingCharacter").GetComponent<Animator>().runtimeAnimatorController;
}
}
It is a long time since this question was asked, but for future reference i found if you open the Animation window and lock it in place, you can click other objects and maintain the animation preview on scene mode.