Graph Reset

Forums 💬 NodeCanvas ⚙️ Support Graph Reset

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #17689
    mgb
    Participant

      Hi,

      We’ve created an FSM we use to coordinate a game mechanic and want to re-use it in the scene as required.
      I can’t seem to find a function to reset the graph & blackboard for a fresh use – does one exist?
      I did try to instantiate the FSM as new every time but strange things occurred (something destroys the GraphOwner & Blackboard after Start is called on subsequent uses – not sure who/what!)

      Ta,
      M

      #17693
      Gavalakis
      Keymaster

        Hello,

        If you want to make a reusable FSM, you can either create an FSM asset and have it assigned on any FSMOwner that you want, or alternatively create an FSMOwner and make it prefab. Can you please clarify the usage?
        Regarding instantiating the FSM, that should be working correctly. Do you maybe have an ActionTask that destroys the FSMOwner gameobject somewhere ?

        Let me know.
        Thanks.

        #17692
        mgb
        Participant

          OK to clarify usage:

          We have a gameobject in the scene with blackboard and FSM asset assigned to it. I can run the FSM once from code to its end all OK. Re-starting it later doesn’t work (I’m assuming it has previous state that’s interfering, e.g. the graph view shows two green active nodes…)

          Instantiating a prefab instead works ok for the first run again. Re-instantiating lets me start the FSM again, it does its first action tasks, then the owner and blackboard get ‘nulled’ in the code (i.e. Unity’s dodgy null ref overloading for destroyed objects).
          I breakpointed all the Destroy fns I could find but none were hit!

          The only ‘destructive’ action I have is a ForceFinishGraph call in the last state node – no destroy calls anywhere.

          #17691
          mgb
          Participant

            Sorry, the instantiate problem was our bug – the ref to the FSMOwner was going out of scope 😮

            #17690
            Gavalakis
            Keymaster

              Hello again,
              Hmm. Restarting an FSMOwner after it has ended, by calling “FSMOwner.StartBehaviour()” again, should certainly do work.
              The node editor may not be refreshing the visual debugging if it’s not focused, but of course the FSM is running nonetheless.
              If you are still facing problems with that, can you please send me a reproduction project to support_AT_paradoxnotion.com?

              Thanks!

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