-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The "abort_tree " signal may have the wrong target object #21
Comments
It would be best if you create the behavior tree as a separate scene, that way it will have the correct target object. |
Yep, actually I am creating the behavior tree as a separate scene, but the root node isn't the BehaviorTree node. |
If the Behavior Tree is a separate scene, then the owner WILL be the root node. |
I create the behavior tree scene by Xmind2Json, which uses recursion in the main processing function and as a result the root node isn't the BehaviorTree node... LOL class_name BtreeHandler 管理ai相关的处理,如从json生成行为树var json_files_path:String = "res://resource/data/ai/" # ai json 目录 func _init(): 生成行为树PackedScene至特定目录func create_tree_scene():
生成行为树和黑板func creat_tree_nodes(json_file_name:String, mount:Node):
根据json转成的dict和挂载点生成行为树(递归部分)func creat_tree_by_dict(result:Dictionary, mount:Node):
|
Oh ok. That's because nodes added at runtime do not have a owner unless set explicitly. |
Fixed by #22 |
Brilliant solution ^_^ |
As you can see in the screenshot bellow, what you want to abort may be the "BehaviorTree" node, but actually in my case it can raise an error, because the real "owner" is "ai_test" node and it doesn't have any "abort( )" function. :)
The text was updated successfully, but these errors were encountered: