- Home /
2D elevator with animation doesn't start
I'm trying to make a 2D platformer "game". One of my game objects is an elevator.
To make it work I added an animation clip that changes tranform Y position back and forth.
As you can see in the screenshot the animation component has play automatically enabled, but when I run the game it doesn't move.
What is happening here?
Thanks in advance.
does it plays from the Animation Tab or when moving the slider? Attach this to it : using UnityEngine; using System.Collections;
public class test3 : $$anonymous$$onoBehaviour {
void Start(){
Animation anim = GetComponent<Animation> ();
anim.Play ();
}
}
It wasn't necessary, I was having another problem. The animation did start, but once it played it didn't repeat, and the platform was out of view, and by the time the player reaches the platform it already finished so I thought that was never started.
Now I'm struggling to make it work with repeat, I'm using this setup http://answers.unity3d.com/questions/204331/animation-loop.html but doesn't seem to work.