Problem with currentStateName in nested FSM

Forums 💬 NodeCanvas ⚙️ Support Problem with currentStateName in nested FSM

  • This topic has 0 replies, 2 voices, and was last updated 9 years ago by Gavalakis.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18594
    rmon
    Participant

      Hi

      I am trying to get the currentStateName of the FSM inside a ActionTask like this:

      It works fine when the ActionTask is assigned to a standalone FSM, but when assigned to a nested FSM it returns the currentStateName from the topmost FSM, is this a bug ? or is there another way to get the currentStateName the same way no matter if the FSM is nested or not ?

      I am using NodeCanvas V2.5.5

      Thanks in advanced
      rmon

      #18596
      Gavalakis
      Keymaster

        Hello,

        The way currentState is designed to work now, is that it returns the State only within the FSM it is called from. Each FSM holds it’s own currentState. Thus ‘agent.behaviour.currentStateName’ will return the root FSM (one assigned in FSMOwner) current State name.
        Here is a workaround to get the current state name of the task’s own FSM from within an action/condition task:

        Let me know if that works for you.
        I will certainly look after a simple method to get the current state from the FSMOwner regardless of nested or root as well.

        Thanks!

        #18595
        rmon
        Participant

          Thanks Gavalakis

          It works fine.

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