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.

Animator: Retarget (change source/target state of) transitions

Discussion in 'Animation' started by plmx, Mar 27, 2017.

  1. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    306
    Is there some way in the Animator window to change the source or target (state) of a transition (thereby keeping all its other settings)? Thanks!
     
    d2clon likes this.
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    It's not in the Editor right now; this is one of those things where we know how to do a quick hack, but we haven't taken the time to implement it correctly.

    You can use the script I've attached, it adds a right click menu to your inspector, and lets you copy paste transition values.
    upload_2017-3-27_14-5-59.png

    Note: this won't work for transitions from a StateMachine, or Entry transitions. It should not be too hard to fix it, it's just that they don't share all the same members.

    Also, this needs to be in a folder named Editor in your project
     

    Attached Files:

  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    I was testing it a bit, and the script won't work well for multiple transitions; it will always take the first one.
    I'll leave it here for now, until I find something better
     
    TrickyHandz and plmx like this.
  4. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    306
    @DavidGeoffroy cool, thanks for your answer & script, very helpful!
     
  5. kkaehler

    kkaehler

    Joined:
    Nov 15, 2016
    Posts:
    11
    Is this in the editor by now? Just asking, it's been 4 years since the question came up here...
     
  6. jimfhurley

    jimfhurley

    Joined:
    Mar 6, 2015
    Posts:
    7
    Yes! Right click where he says to above (it looks like new state -> new state 0) and the option will appear without the supplied script.
     
    kkaehler likes this.
  7. kkaehler

    kkaehler

    Joined:
    Nov 15, 2016
    Posts:
    11
    Great, thanks :)
     
unityunity