Search Unity

Start animator with random time or delay

Discussion in 'Animation' started by Mikea15, Jan 13, 2015.

  1. Mikea15

    Mikea15

    Joined:
    Sep 20, 2012
    Posts:
    93
    Hello!

    I have variations from my character, say 2 or 3, and all of them have the same animator. What I'd like to do is to have them start the animations at random time / or with delay, so they are not all synchronised. How could I achieve that?

    Thanks.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    7,203
    Could disable animator component by default,
    then in the script Start(), enable the component after random wait delay..

    (not tested)
     
  3. Mikea15

    Mikea15

    Joined:
    Sep 20, 2012
    Posts:
    93
    This is what I just did, but not having the character moving with the animator is delaying is not an option. The thing that comes to mind is having different idle animations, and add randomisation.. Any thoughts?
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
  5. Mark30504

    Mark30504

    Joined:
    Sep 18, 2021
    Posts:
    5
    Ok all seems pretty easy ?
    but does not work ?

    Looking for simple code, Unity example not really working either

    Want to start animation with some delay

    it appears the order of information for Anamator.Play is (animation to play name ?, 0 (for some reason), delay)

    Seeing my sprite has an animation I am guessing there is a way for the software to fill the animation name with a little code.
     
unityunity