For the short version, here is the direct question:
Does an idle state, without any animation use system resources while playing? If it does, what is the best way of starting an animation without having that idle state waiting for a trigger to start the animation?
Long Version:
Hello everyone. I started working recently on Unity 5 so I still don’t know that much about it. Never used it before too.
I have a scene with a door, and an animation that rotates the door handle. I want to play the animation when the player hits the action key (for now I just used E) near the door. I manage to make this work, but I think it isn’t very good in terms of resources. What I did was adding a box collider with trigger and then on a script added the folowing:
void OnTriggerStay()
{
if (Input.GetKeyDown(KeyCode.E))
{
anim.SetTrigger("StartRotation");
}
}
In the animator I made a “idle” state that does nothing, and then added a transition to the rotating animation, based on that trigger. I unchecked the “Has exit time” checkbox and it seems to work properly. When I press E near the door, the Door Handle rotates instantaneously. What I think it’s not good is, the “idle” state is always playing, and I wonder if because of that it isn’t wasting resources…
I’m using mecanim though…