Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How Do I Wait The Animation To Finish Before Running A Line Of Code

Discussion in 'Scripting' started by MammothSaturn83, Apr 12, 2019.

  1. MammothSaturn83

    MammothSaturn83

    Joined:
    Feb 10, 2018
    Posts:
    20
    How do i wait the animation to finish before running a line of code

    -Thanks Nicholas
     
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    Use an animation event at the end of the animation timeline.
     
  3. MammothSaturn83

    MammothSaturn83

    Joined:
    Feb 10, 2018
    Posts:
    20
  4. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
  5. MammothSaturn83

    MammothSaturn83

    Joined:
    Feb 10, 2018
    Posts:
    20
    I mean how do i make it so it waits untill its finished after that?
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,382
    Make a function in your code with the same name as the event and put whatever you want to happen at the end of the animation in that function. When the event fires at the end of the animation your function will be called.