Hi all, I've just looked over the API for Animated Sprite and couldn't find the function (or clues) on what I'm doing wrong. What I want to do is repeat my sprite during some behaviour (i.e. keep it locked in a jump pose whilst it's jumping). The code is:
if (Input.GetKey("space")) {
if (!this.motor.IsGrounded()) {
if (!anim.IsPlaying("jump")) {
anim.Play("jump");
}
}
// The delegate is used here to return to the previously
// playing clip after the "jump" animation is done playing.
anim.animationCompleteDelegate = HitCompleteDelegate;
}
Which looks functionally correct (to me) but the Animated Sprite doesn't hold the pose and can "walk on air" if you like. I've tried replacing the Grounded if to a while but Unity blew up.
I've tried playing with the Sprite Animation clip editor settings between single/loop/creating more frames etc., but this doesn't seem to work.
I've not tried simply making a long looping animation of the same sprite because this seems like a philistine way of approaching it (if it does indeed work).
Please let me know!