Home>

Normally it is stationary, but I want to create a GameObject called fire that moves when the start button is pressed.

I struck the code while checking various things on the net, but it is exactly the same behavior as before adding the code.
The error is
MissingComponentException: There is no'Animation 'attached to the "fire" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "fire". Or your script needs to check if the component is attached before using it.
Is coming out.

Applicable source code

public void StartButton ()
{
flag = 1;
timer = 0.0f;
GameObject obj = GameObject.Find ("fire");
Animation anim = obj.GetComponent ();
anim.Play ();
}
I wrote, but it does not move at all.