Skip to content

Commit

Permalink
Unregister BT instance with debugger if BTPlayer is removed from tree
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed Aug 3, 2024
1 parent 91edd1c commit 869b646
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bt/bt_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void BTPlayer::set_behavior_tree(const Ref<BehaviorTree> &p_tree) {
_update_blackboard_plan();
} else {
behavior_tree = p_tree;
if (get_owner()) {
if (get_owner() && is_inside_tree()) {
_load_tree();
}
}
Expand Down Expand Up @@ -170,13 +170,15 @@ void BTPlayer::_notification(int p_notification) {
#ifdef DEBUG_ENABLED
if (bt_instance.is_valid()) {
bt_instance->set_monitor_performance(monitor_performance);
bt_instance->register_with_debugger();
}
#endif // DEBUG_ENABLED
} break;
case NOTIFICATION_EXIT_TREE: {
#ifdef DEBUG_ENABLED
if (bt_instance.is_valid()) {
bt_instance->set_monitor_performance(false);
bt_instance->unregister_with_debugger();
}
#endif // DEBUG_ENABLED

Expand Down

0 comments on commit 869b646

Please sign in to comment.