Animation Clips

Sorry if this is a bit of a dumb question, but I’m new to animating in Unity. How do I tell an animation clip (not all clips, just one of them) to not use Loop. And once I’ve done that, how do I check that it has finished. Thanks!

This will set one animation to a certain wrap mode:

animation ["NameOfAnimation"].wrapMode = WrapMode.Once;

You could check if it isn’t playing currently. Probably like this:

if (!animation.isPlaying ("NameOfAnimation"))
{
}

The first one works well, thanks. However the second part gives me an error: “It is not possible to invoke an expression of type ‘boolean’.” Well, why not? O_o It looks right in the documentation…

Oops, sorry. Here’s what it should be:

if (!animation.IsPlaying ("NameOfAnimation"))
{
}

Ha ha! Works like a charm. Thanks pal. :slight_smile: