So I'm trying to have my script pause an animation when the user clicks. Here's what I have so far:
I defined the animation up at the top
public Animation anim;
and then further down,
void Update () {
if (Input.GetMouseButtonDown(0))
{
anim["myAnimation"].speed = 0.0f;
}
}
Code gives no error, however in Unity I have a GameController object to which this script is attached to. The gamecontroller object has a vacant field into which I drop my animation to. The issue is that when I try and drag and drop my animation or try to place it into that field, nothing happens, I keep getting the error down at the bottom saying that "The variable anim of GameController has not been assigned." How do I go about assigning myAnimation to the variable anim?
When I try and drag and drop my animation file to this, nothing happens. This is under the GameController script which I assigned to a GameController object.
AnimationController
. \$\endgroup\$