I have a simple class with Mecanim State Machine Behaviour which looks like this:
public class AnimationStateChanger : StateMachineBehaviour {
public string stateName;
public bool onStateEnter = false;
public bool onStateExit = false;
public int changeToState;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (onStateEnter)
{
animator.SetInteger(stateName, changeToState);
}
}
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (onStateExit)
animator.SetInteger(stateName, changeToState);
}
}
In the Unity Editor and Windows Build i don’t get any errors. However when i build it for WebGL i get:
Script Error: (AnimationStateChanger) OnStateEnter() can not take parameters.
Script Error: (AnimationStateChanger) OnStateExit() can not take parameters.
Script Error: (AnimationStateChanger) OnStateUpdate() can not take parameters.
and etc including all overridable methods. Any ideas?