- Home /
State machine callbacks not being called on mobile iOS?
Hello!
I use Unity 5.3. Callbacks OnStateEnter
, OnStateUpdate
and OnStateExit
are not being called when I build and run my game from iPhone 6. Everything works from within Unity editor and suddenly stops working on mobile.
I created a simple menu with states: Closed (initial), Opening, Closing. Initial "Closed state" has TestSMB attached which overrides OnStateEnter, OnStateUpdate and OnStateExit and logs that it has reached these functions. Again, everything logs successfully inside Unity. Doesn't work on iPhone. Functions are never reached.
Is there anything I missed and should be tweaked for it to work on mobile iOS? Or is this some kind of bug and if so, how come no one is talking about this - this is a huge thing!
UPDATE:
In Xcode I get this output:
Script error (MyTestSMB): OnStateExit() can not take parameters. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Mono/MonoScriptCache.cpp Line: 411)
Seems to be similar to this thread: http://forum.unity3d.com/threads/webgl-mecanim-state-behaviour-onstateenter-onstateupdate-cannot-take-parameters-error.375766/
Answer by FlorianBaptiste · Jan 15, 2016 at 05:44 PM
Apparently, the similar thread mentioned above (on web GL) will be fixed on Unity 5.4. Hopefully it will be fixed on iOS as well.