Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Animation.Play doesn't play animation

Discussion in 'Animation' started by yosimba2000, Jun 22, 2021.

  1. yosimba2000

    yosimba2000

    Joined:
    Jun 3, 2021
    Posts:
    24
    can someone help me figure out my why animation doesnt play?

    here's my project. it's just a test animation

    https://easyupload.io/nx0dl5

    essentially i just have a cube running a timeline animation, and my code is using
    Code (CSharp):
    1. if (Input.GetKey("a")){ transform.GetComponent<Animator>().Play("test"); }
    but the animation doesn't play except on the first run of the project.

    ive attached the script to a hierarchy object as well...

    I've disabled the Loop checkbox as well since I only want the Animation to play once for each press of "a"