So I’m just trying to get the bare basics of unity down. I have a gate near the start of the level that is supposed to lower when the game starts. Super basic, yeah? But the animation won’t stop looping. I don’t have a script controlling it or anything, I’m just working from the basic animation properties. I’ve unchecked Loop Time, Play Automatically, anything I can find that looks related to looping, and yet the animation keeps on rolling. I just want the animation to play once. How do I stop the looping?
Here’s the various windows:
You need to create a script controlling it so maybe just create a C# Script put the following directly under Void Update :
animation.Play(“Spike_Lower”);
animation.wrapMode = WrapMode.Once;
So it should look like
void Update () {
animation.Play(“Spike_Lower”);
animation.wrapMode = WrapMode.once;
}
and then attach the script as a component of the gate
I’m not the BEST person to help you because I’m pretty new to Unity as well, but your problem is that the object you created, the gate, only has one animation clip – with the gate raising or lowering or whatever. It keeps looping even though you’ve told it not to because it doesn’t have anything else to do. What you need to do is create a second state which is basically “Idle”. Then you create transitions between the two objects going both ways. This way, when the gate opens, it stays open. And then when you need it to close, you can then just transition back to closed. Hope that helps! I’d go into more detail but if you have the gate going one way, the rest is cake. 