Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Stop Animation from Automatically Playing?

Discussion in 'Animation' started by SprinkledSpooks, Jul 20, 2016.

  1. SprinkledSpooks

    SprinkledSpooks

    Joined:
    Jun 1, 2016
    Posts:
    117
    I'm new to animating in Unity and I just recently made my first animation in which a door slides open. However, now this animation plays automatically before I can use a script to trigger the animation. How would I go about disabling the ability for this animation to play automatically?
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    490
    Using the Animator component: create a state with no animation in it, and set that as the default state.

    After that, you can either
    * add a transition between your new empty state and your animation that depends on a trigger parameter
    * call Animator.Crossfade to start your state
     
  3. MisterSkitz

    MisterSkitz

    Joined:
    Sep 2, 2015
    Posts:
    833
    I get what you're saying and this is exactly what I'm looking to do. However, I don't fully grasp adding the parameters. I created a trigger and named it "Start" because I want it to start my animation. However, I don't know how to put this to use.
     
  4. sparkey13

    sparkey13

    Joined:
    Dec 28, 2016
    Posts:
    1
    This doesn't seam to work. In my case it keeps looping the empty state and doesn't give control to my game logic.
    I have some game logic that translates and rotates my player. And that doesn't run because the empty state keeps looping.
     
unityunity