[BUG] FSM error when using DestroyGameObject ActionTask.

Forums 💬 NodeCanvas ⚙️ Support [BUG] FSM error when using DestroyGameObject ActionTask.

  • This topic has 0 replies, 2 voices, and was last updated 6 years ago by Gavalakis.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #16376
    guyboots_thunderbro
    Participant

      This exception happens when using Destroy GameObject on the current agent:

      At the line in the stack trace, currentState is null. It becomes null after FSM.cs:84, currentState.Update(). FSM.cs:76 does a null check, but it’s too early, or maybe there needs to be another?

      Using NodeCanvas 3.0.5. Unity 2019.3.10f.

      #16382
      Gavalakis
      Keymaster

        Hello,

        Just to clarify, is the Destroy GameObject call happening from within the update of the FSM itself, or from some other part of your code?

        Thanks.

        #16381
        guyboots_thunderbro
        Participant

          > Just to clarify, is the Destroy GameObject call happening from within the update of the FSM itself, or from some other part of your code?

          Using the Action Task Destroy GameObject.

          #16380
          guyboots_thunderbro
          Participant

            I’ve attached a screenshot.

            #16379
            Gavalakis
            Keymaster

              Hello,

              Yeah, this is an edge case because the FSM is destroyed from within it’s own update. Here is quick fix though. Please open up FSM.cs and completely change the method named ‘OnGraphUpdate’ with the following code:

              Let me know if that quickfix works for you.
              Thanks 🙂

              #16378
              guyboots_thunderbro
              Participant

                I have identical changes here locally, so can confirm this works.

                #16377
                Gavalakis
                Keymaster

                  Great.
                  Thanks for confirming and I am glad the change was the same 🙂

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