Search Unity

Playing until a time on an animation.

Discussion in 'Scripting' started by MrZeker, Mar 17, 2019.

  1. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    Hello, im trying to find a way to play just a part of an animation. What its going is, an animation is being played, and once the event happens i want the animation to play until the keyframe 10 (which would be the half of the animation), wait two seconds and then play the rest of the animation.
    What would be the best way to do this?. i know i can use a coroutine for the waiting part, but right now i dont know how to set an animation to play up to the desired keyframe.
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    In the animation export window there's animation events tab. Place a event where you neet to pause, pause, wait coroutine, then play again.
     
  3. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    can i call that event from script at will?
     
  4. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    In your script this event will be a regular function.
     
  5. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    i seem to be failing at doing it. can you help me with an example?
    im trying to use it in a jumping animation as a test, i created an event at half, and one at the end, with INT values of 1 and 2 respectively, however when i try to call them nothing happens.
     
  6. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748