bitbrain / beehave

🐝 behavior tree AI for Godot Engine
https://bitbra.in/beehave
MIT License
1.85k stars 116 forks source link

Debug tree disappears if the actor is reparented #338

Closed BenCarroll150 closed 2 months ago

BenCarroll150 commented 3 months ago

Godot version: Godot_v4.2.1-stable_win64

Describe the bug When an actor (any node with a BeehaveTree) is reparented with actor.reparent(new_parent_node), it ceases to appear in the list of actors in the Beehave debug menu, so you cannot see the tree in real-time.

To Reproduce Steps to reproduce the behavior:

  1. Create the node structure:

    Main
        NewParentNode
        Actor
            BeehaveTree
                ActionLeaf
  2. Attach a script to Main, and add the following to its _ready() function:

    func _ready():
    var actor = $Actor
    var new_parent_node = $NewParentNode
    actor.reparent(new_parent_node)
  3. Run the game, go to the Beehave debug menu, and the actor's BeehaveTree will not appear.

  4. (You can also have the reparenting happen on a timer to see it disappear in real-time)

Expected behavior Beehave trees of reparented nodes continue to appear in the Beehave debug menu

Screenshots If applicable, add screenshots to help explain your problem. Setup: BeehaveDebug1

Before reparenting: BeehaveDebug2

After reparenting: BeehaveDebug3

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context N/A