- Home /
How to Prevent Mecanim from Cloning Behaviours?
Hey there!
I'm running into issues with Mecanim. I'm using it as a state machine, and have a nifty Behavior script that informs the main player script of what it can and can't do with each state.
The issue I'm having is that, at runtime, the system creates three clones of the script from random, unrelated states and slaps them onto the current state, overwriting the actual script I have on it:
In the Editor:
At Runtime:
This is weird, because the system is only supposed to be in a single state at one time, none of the states have Transition Times, and there's only a single layer.
Any idea why it's doing that, and how I can prevent it?
Answer by generalmcmutton · Nov 07, 2018 at 08:30 PM
Aaaand I figured it out, which wouldn't have happened had I not posted the question initially.
I was unaware that the Behaviors applied to the State Machine's Base Layer, and the ones applied to a Substate Machine's top bit carry over to their children- this is why multiple clones of the same behavior were present on every State.
Ignore meee!
Your answer
Follow this Question
Related Questions
StateMachineBehaviour: Where should I set up references? 2 Answers
Altered Mecanim parameters reset the current state back to the default state. 0 Answers
Is there a way to get a StateMachineBehaviour on a specific State 2 Answers
Mecanim and script behaviour issue 1 Answer
Is Animator.SetBoneLocalRotation working as intended for the hips? 0 Answers