ActionTask OnStop not called when ANY STATE node fired

Forums 💬 NodeCanvas ⚙️ Support ActionTask OnStop not called when ANY STATE node fired

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15442
    porters25
    Participant

      Hi,

      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.

      #15443
      porters25
      Participant

        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.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.