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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Animator how to return to start position

Discussion in 'Scripting' started by Quantum_Surt, Aug 13, 2017.

  1. Quantum_Surt

    Quantum_Surt

    Joined:
    Apr 25, 2015
    Posts:
    39
    Hi, I just want to do something like that :

    - Animator.Play("...");
    - Animator.SETBACKANIMATION("...");

    -Animator.Play("...");


    I searched for it during a while but did not find an answer...

    Thank you
     
  2. dpgdemos

    dpgdemos

    Joined:
    Apr 28, 2014
    Posts:
    24
    You can set the playback time back to zero.

    Code (CSharp):
    1.  
    2. private Animator _animator;
    3.  
    4. // In Animator manager method.
    5. _animator.playbackTime = 0f;
    6.  
     
  3. Quantum_Surt

    Quantum_Surt

    Joined:
    Apr 25, 2015
    Posts:
    39
    seem logical but nor working, my object is still at final place...
     
  4. Quantum_Surt

    Quantum_Surt

    Joined:
    Apr 25, 2015
    Posts:
    39
    This is working to start from 0

    animator.Play("...", -1, 0f)

    But I need to make animation stay to starting position and then play it in a second time
     
  5. Quantum_Surt

    Quantum_Surt

    Joined:
    Apr 25, 2015
    Posts:
    39
    It could be ok to manually fix position but even this seem difficult... Animator is locking them...