I have a sub-FSM that contains a bunch of states. Some of these states have custom ActionTasks that run coroutines when executed. Any active coroutines are stopped when OnStop is fired within the ActionTask.
The parent FSM has an ANY STATE node that transitions to a ‘dying’ state when the ‘Died’ event is raised. The ‘Died’ event can be raised anywhere, hence why ANY STATE is being used. When the dying state is running, the gameobject containing the FSM graph is destroyed. When this occurs, Unity often throws an error telling me that one of my ActionTasks is trying to access a property from the gameobject which is now destroyed/null. I believe the culprit may be one of my coroutines on the sub-FSM state ActionTasks.
Looking through my debug logs, it would appear that OnStop is not being called any currently running ActionTasks when ANYSTATE transitions to a different state. This means my coroutines are still running (I think).
Is there a way for ActionTasks to exit cleanly when an ANY STATE transition occurs? OnStop does not seem to work in this case.
Please ignore the above. OnStop does appear to fire when ANY STATE is activated. I had turned off Debug Log messages which is why I didn’t notice. My bad.
Author
Posts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.