Search Unity

Animator - looping issue

Discussion in 'Animation' started by alexhajdu, Nov 28, 2013.

  1. alexhajdu

    alexhajdu

    Joined:
    May 27, 2013
    Posts:
    2
    Hello,
    I've created 2 animations on my prefab.

    In my Animator window I created something like this:

    $scr2.png
    $scr.jpg

    When I start the game, the animation is looping from Idle to Jump, but I want to keep my character in idle and fire jump action on some keystroke. How can I do that please?
    Thanks in advance and sorry for noob question...
     

    Attached Files:

    Last edited: Nov 28, 2013
  2. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    238
    I'm interested in something similar -- my animation always auto-plays. In previous versions of the Animation system I could simply turn auto-play to false and then control the start and stop through code. I guess I could add a script that set auto-play to false on Start(), but I was hoping there was a way to do this through the editor? Thanks in advance for any help!
     
  3. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    238
    You can add this script to your Lion GameObject...

    Code (csharp):
    1.  
    2. public Animator animator;
    3.  
    4. // Use this for initialization
    5. void Start ()
    6. {
    7.   animator.speed = 0;
    8. }
    9.  
    ... and then drag-drop your Animator unto the animator field. This feels like a hack thou, hopefully someone from Unity can tell us how to set an animation to not auto-play.