[BUG] Copy BT or FSM Component keeps reference to old BB

Forums 💬 NodeCanvas ⚙️ Support [BUG] Copy BT or FSM Component keeps reference to old BB

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16676
    fratigo
    Participant

      Hi,
      when copying a BT or FSM component from gameobject A to gameobject B a new local blackboard is created in gameobject B, but the binding of the new BT or FSM is still to the blackboard of gameobject A (visible in the node canvas). The new blackboard is empty.

      I would expect the BT or FSM to be bound to the new local blackboard.

      This is not happening when duplicating a gameobject.

      Regards, Frank

      #16679
      Gavalakis
      Keymaster

        Hello Frank,

        Indeed, this can certainly qualify as a bug. The problem however is that Unity does not really provide a proper callback for when a component has been copy/pasted like this. There does exist the “Reset” callback, but that is called before Unity overwrites the component data (serialization) by copy paste from previous one. Thus the order is:

        • Component is pasted as new.
        • Reset is called. I could do something here, but,
        • Then Unity actually does the copy/paste and overwrites any changes anyway.
        • Then there is no other callback after that. :-/

        I think that the best way to avoid some confusion, would be to expose the Blackboard field in the GraphOwner inspector (which is currently only possible to see if one enters the “Debug Inspector Mode”).

        What do you think?

        Thank you!

        #16678
        fratigo
        Participant

          Hi Vaggelis,
          thanks for your prompt answer! Sounds like a difficult task. I would expect the copy/paste of the component to behave like a save/load of the BT or FSM. Actually this is what I have done as a workaround.

          I’m not a big c#/unity pro but from your comment I guess, that the construction of the new node canvas component is no option for additional action. Maybe it can be done during activation? Since from my understanding the node canvas component must not be bound to a different blackboard than the local one. Or?

          Or maybe the local blackboard can be used to check the correct bindings of the local node canvas components? When I tested it, a local blackboard was created but not used, so there is one in all cases.

          Regards, Frank

          #16677
          Gavalakis
          Keymaster

            Hello again Frank and sorry for the late reply due to summer vacation.

            Actually, (and technically) the GraphOwner component CAN reference another blackboard, one that is not attached on the same gameobject as the GraphOwner component is. GUI-wise however, this is not possible since there is not “Blackboard” Object field to assign a different blackboard.

            This is why I am thinking of instead of enforcing the use of the Blackboard only attached to the same gameobject, to rather expose an Object Field to assign any blackboard regardless of which gameobject it is attached on, since it is technically possible and may have some nice use cases as well, like sharing a single Blackboard between multiple GraphOwner (something that was actually possible many versions back). 🙂

            Thanks!

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