Search Unity

Animator is not showing my animation

Discussion in '2D' started by pitchouly, Sep 21, 2017.

  1. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    Hello,

    I'm a beginner with Unity, and i want to create an animation.
    I'm following the tutorial "Making a flappy bird style", i'm at part 4 "animating the bird".
    I don't know why, i can't see the animation when using the animator in play mode. (i don't see the animation when i clik neither).

    this is how look my animation :




    and this is my animator



    can someone explain it to me please ? :s

    Thank you
     
  2. Bakaender

    Bakaender

    Joined:
    Dec 31, 2013
    Posts:
    3
    Maybe try connection from any state to die?
     
  3. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    No the bird on the second image is alive, not dead. The animation shows us that it has to be dead, but he won't die. :/

    It's just a single frame but i have set to false the bow "has exit time". So when he dies he has to stay dead. Am i wrong ?
    So we should see this animation.

    i had try with a code, but it's the same issue.
    That's my code if it can be usefull :


    public class BirdController : MonoBehaviour {

    public float upForce;

    private bool isAlive;
    private Rigidbody2D rb2d;
    private Animator anim;

    void Start () {
    isAlive = true;
    anim = GetComponent<Animator>();
    rb2d = GetComponent<Rigidbody2D>();
    upForce = 200f;
    }

    void Update () {
    if (isAlive)
    {
    if (Input.GetMouseButtonDown(0))
    {
    anim.SetTrigger("Flap");
    rb2d.velocity = Vector2.zero;
    rb2d.AddForce(new Vector2(0, upForce));
    }
    }
    }

    void OnCollisionEnter2D()
    {
    anim.SetTrigger("Die");
    isAlive = false;
    }
    }

    Thank you for your response
     
  4. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    I try the connection "any state" to "die" with condition "die", and no exit time. But nothing is showing up :s
     
  5. Deleted User

    Deleted User

    Guest

    Your animation only has one frame?
     
  6. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    yes it has. The tutorial says to delete the last image to have an animation who stay the same 'till the end
     
  7. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    I don't have the blue load bar below any states in the animator when i clik on play. Maybe the issue is there ?
     
  8. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    Sorry i made a mistake when i answered. Animations have 14frames each. I see this in the preview windows in the inspector.
    Moreover i notice that the animation work in this preview, but not in the game mode.
     
  9. pitchouly

    pitchouly

    Joined:
    Jul 11, 2017
    Posts:
    12
    Removing and re-adding the animator fixed the problem.
     
    Yildiran likes this.