diff --git a/bt/bt_player.cpp b/bt/bt_player.cpp index bd00b44..e491ec8 100644 --- a/bt/bt_player.cpp +++ b/bt/bt_player.cpp @@ -93,6 +93,13 @@ void BTPlayer::set_behavior_tree(const Ref &p_tree) { } } +void BTPlayer::set_agent_node(const NodePath &p_agent_node) { + agent_node = p_agent_node; + if (tree_instance.is_valid()) { + ERR_PRINT("BTPlayer: Agent node cannot be set after the behavior tree is instantiated. This change will not affect the behavior tree instance."); + } +} + void BTPlayer::set_blackboard_plan(const Ref &p_plan) { blackboard_plan = p_plan; _update_blackboard_plan(); diff --git a/bt/bt_player.h b/bt/bt_player.h index 74b72e2..026185d 100644 --- a/bt/bt_player.h +++ b/bt/bt_player.h @@ -58,7 +58,7 @@ public: void set_behavior_tree(const Ref &p_tree); Ref get_behavior_tree() const { return behavior_tree; }; - void set_agent_node(const NodePath &p_agent_node) { agent_node = p_agent_node; } + void set_agent_node(const NodePath &p_agent_node); NodePath get_agent_node() const { return agent_node; } void set_blackboard_plan(const Ref &p_plan);