- Home /
The question is answered, right answer was accepted
2d Animation - Play once, then stop at end position
Hello,
I am currently trying to setup a title screen for my project. The title screen consists of three animations - TitleText1, TitleText2, CharcaterAnimation. All three of these componenets need to start off screen. I have animatons attached via animatior controllers to each object. Each animation brings the objects on screen, and performs some movement.
My question is, how can I get them to only play once and then show the objects at their finishing position?
So far this is my title screen manager class:
public class TitleScreenManager : MonoBehaviour {
public Animator titleScreen1;
public Animator titleScreen2;
public Animator characterAnimation;
public GameObject titleScreen1obj;
public GameObject titleScreen2obj;
public GameObject characterObj;
// Use this for initialization
void Awake () {
titleScreen1obj = GameObject.Find ("TitleText1");
titleScreen2obj = GameObject.Find ("TitleText2");
characterObj= GameObject.Find ("CharacterObject");
titleScreen1 = titleScreen1obj.GetComponent<Animator> ();
titleScreen2 = titleScreen2obj.GetComponent<Animator> ();
characterAnimation= characterObj.GetComponent<Animator> ();
titleScreen1.SetBool ("playTitleBounce1", true);
titleScreen2.SetBool ("playTitleBounce2", true);
bounceyBounceAnim.SetBool ("playBounceIntro", true);
}
// Update is called once per frame
void Update () {
}
With this code I have no problem getting the animations to play, the only problem I'm comming up with is how do I set them to only play once? I have bool parameters setup in my animator that I use on awake to start the animations, but how do I stop them after they play through once? Also how can I have it so that the objects remain in their position that the end of the animation places them in?
Any help is apprecaited.
Thanks
Answer by _1 · Feb 22, 2014 at 10:02 PM
find the animation you are using and double click on it where it says loop time uncheck that
Best of luck :)
Oh wow haha how simple! Don't I feel silly :)
Thanks for your time and response, worked perfectly!
Been stuck with this for nearly an hour, editing code and trying to figure out how to stop the animation. Thanks.
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Animator has not been initialized!!!!!! Help!! 2 Answers
UI Text Alpha not fading out in animation 0 Answers
UFPS - Player Animation Setup 0 Answers
Blending between frames in the same animation (fake stop motion) 2 Answers