Dos:
- Use
OnStateTick
to switch between states usingChangeState(EState.___);
and execute typicalFixedUpdate
/Update
code in relevantif(state == EState.___){
scope here}
. - Use
OnStateEnter
to changing values (like moving speed etc.) and executing code once (switching animations, triggering animator states) - Use
OnStateExit
for resetting values set inOnStateEnter
back to their defaults (like moving speed back to normal etc.).
Don'ts:
- Do not change
_state
manually (i.e. using_state = EState.___
). This is whatChangeState(_)
is for. - Do not call
ChangeState
fromOnStateEnter
and `OnStateExit - this will cause errors (!) and makes no sense if you think about it.