Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Playing animation, stopping then playing again

Discussion in 'Scripting' started by Afrokid001, Feb 16, 2014.

  1. Afrokid001

    Afrokid001

    Joined:
    Jun 3, 2010
    Posts:
    89
    Hi guys,

    I am trying to play an animation on my main character, when colliding, make it stop and start again later.

    I know how to do the colliding side of it, but for some reason, when I make the animation, and play it through the animator it plays (yay?).

    But I can't get it to stop (I would of thought Animator.enabled = false; would work but its telling me " 'Animator' is not a member of 'UnityEngine.Animator'. ").

    So I thought, hmm load it through a script. So I made an animation component, added the animation, it tells me that it should be a legacy animation so I change it.. ok it should work but nope.. animation.Play("Swimming"); does nothing. And the Animator does not play it when it is legacy either?

    What am I doing wrong?
     
  2. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632