Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Animation.Play doesn't play animation

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

  1. yosimba2000

    yosimba2000

    Joined:
    Jun 3, 2021
    Posts:
    25
    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"