- Home /
Copy/Paste Mecanim Transitions
I created a complex state machine that has several transitions from an idle state:
Idle -> walk
Idle -> jump
Idle -> sit
Idle -> crouch
Idle -> lie down
(many more)
I have since realized that I want to have several Idle states and randomly get chosen to give variation to my character instances.
Because otherwise the character instances that start at the same time look choreographed performing the same idles at the same time.
There are two ways I can see to achieve this. One is have each idle state inside a sub state machine and a random int chooses which one to play. The other is to have two separate blend trees with the series of idles inside and have each on set by a float and transitions to the other blend tree idle, and then chooses another float before transitioning back.
Either way I have to copy all the numerous 10+ transitions from my old single idle state to either both my blend trees as exits or to each of the idles.
However there appears to be no quick way to copy/paste animation transitions.
Am I expected to manually rebind all these transitions or can the current idle state be copied with all its currently attached transitions and then substitute in other animations/ or sub state machine/blend tree in that states place?
The multiple randomly chosen idle state question has been asked many times before but doesn't appear to have a clear answer which is strange for what I would assume is a common problem.
Answer by Alacer · Jan 14, 2018 at 08:54 PM
3 years later, i know. But this came up as one of the first when google it.
I found out that it is possible to copy a transition with the conditions. Click your transition, in the inspector right click your transition you can find at the top under Transitions, there you can select copy. Then you just make a new transition and right click to paste.
i've just logged in to say that THIS worked briefly for a specific version of Unity 2018. The right click contextual menu has only "Reset" since 2019.
This is extremely inconvenient.
Answer by muzboz · Oct 07, 2020 at 09:10 PM
As @Alacer already said above... (but I wanted to provide a screenshot as well for clarity):
Click your Transition line in Mecanim to select it.
In the inspector, right click on your transition in the Transitions list at the top under Transitions (see image below).
There you can select Copy Transition Parameters.
Now you can select another Transition line in Mecanim.
And in the inspector, right click your transition in the Transitions list.
Now you can select to Paste the Settings, or the Conditions, or Both.
Confirmed. Accounting for clarity, this should be the best answer. Please upvote.
Thank you for this. Copy-pasting the Mecanim substate machines loses all state and transition data, but copying the transition values is very helpful. And it is very well hidden where to copy any parameter values as you need to right-click on the transition as showed in the pic.
Answer by mambo_2 · Jun 10, 2015 at 03:35 PM
http://forum.unity3d.com/threads/script-to-copy-statemachines-whole-controllers.332008/
Try using this script I created for this purpose!
Answer by Max_Bol · Jul 28, 2016 at 10:24 PM
I'll be franc with you, which might sound harsh... But method of creating a multi-layered state layout with, for example, 5+ states coming out of Idle, run, walk, etc. is actually obsolete and actually useless since Unity 4's mecanim upgrade.
The best way (both in time and with the system) is to uses the "Entry" and "Exit" nodes correctly. The best way of describing the Entry & Exit node is that they are linked together in a seamless way that automatically adapt when set correctly.
For example, by setting an Integer (int) parameter called "GeneralState" as this : 0 = Idle (can be a state of a Blend tree)
1 = walk
2 = Run (could be a blend tree with walk if both animation blend correctly)
3 = jump
4 = sit
5 = crouch
6 = lie down
• You like all those states with Entry (green) and Exit (Red nodes).
• You put Idle as default (orange). This means that whenever "GeneralState" is 0, the character is in Idle.
• You add the condition "GeneralState" "if equal" 1-6 (based on which action) with the transition between entry and the states.
• You add the condition "GeneralState" "If not equal" 1-6 (same as previous point) with the transitions from each nodes toward exit (red) node.
Now, whenever you change (with whatever method or parameter) it so that the GeneralState change, the animation move through the exit node and automatically re-enter through the Entry node with the same parameter as when it went through the exit node. The only "touchy" thing is triggers. A good way of managing triggers is to use actual State-Machine with trigger transitions. (Remember, you can copy the whole State-Machine with a right click and then pass the whole this as a sub-state-machine a bit similar to how Blend-trees works, but with actual sub-graphics states.)
With this method, you only have to put the transition from the entry and exit point once.
Answer by aegis123321 · Dec 26, 2020 at 03:00 PM
I met this problem but didn't find a good solution, so I made a tool to copy/paste transitions.
https://github.com/qwe321qwe321qwe321/Unity-AnimatorTransitionCopier
I hope it helps anyone who's been suffering from changing state in complex animator.
Your answer
Follow this Question
Related Questions
mecanim move and root animation 0 Answers
AnimatorTransitionInfo.IsName() Not Working 1 Answer
Animation will not Return to Proper State 2 Answers
Mecanim unwanted transition plays after character death 0 Answers
Mecanim state problem 1 Answer