The debug view stops working

danny100

New member
The debug view in which the nodes are highlighted green as the tree is executed during play only works once after a fresh boot.
If I restart Unity, enter play mode, select the game object with a behavior, I can see the debug view in action. But after this first time it stops working and does not work again until I restart.
Is there any way to get it working again without restarting?

Thank you
 
Are you able to tell me how to reproduce this within a fresh project? The only thing that I can think of is that you are selecting an external tree and when you hit play that external tree is instantiated so you then need to select the active GameObject.
 
Thank you for the reply!
I've made a video of the issue here:


The spawned game object is using an external tree.

steps:
Start unity, enter play mode, select the instantiated game object with the external tree reference. Observe debug view in tree interface.
restart play mode. select same game object, observe debug view is not working anymore.
 
Hmm, are you able to reproduce it within a fresh project? Are you sure the pig behavior tree is active?
 
The behavior trees are definitely active.
I found a work around, if I disable/enable the behavior component manually in the inspector, the debug visualization starts working again
1611806118576.png
 
The debug view only works when 'Start When Enabled' is enabled on the behavior tree component. My behavior tree components have this property disabled- which is a requirement for my spawning code. Is there another way to force activation of debug view? A button that explicitly starts debug view would be nice.
Currently I have to disable the game object, turn on 'Start When Enabled' on the Bt component, and re-enable the game object. This can be a real pain for certain assets (they do things on disable/ enable) and this situation comes up more and more frequently.
Other than this issue, I love the tool! Thank you
 
Have you been able to reproduce the issue within a fresh project? This will allow me to better understand what is going on as I haven't seen this occur before.
 
The same is happening to me. Once I open the Behavior Tree this error starts showing in the logs:


KeyNotFoundException: The given key 'NewPlayer - Fighter' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <e40e5a8f982c4b618a930d29f9bd091c>:0)
BehaviorDesigner.Runtime.BehaviorManager.GetTaskList (BehaviorDesigner.Runtime.Behavior behavior) (at <54e4b904ef9a4d4792c51489161280c3>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.UpdateNodeTaskMap () (at <2f3a218dc3d84eeeb8c3162120be0055>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.LoadBehavior (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean loadPrevBehavior, System.Boolean inspectorLoad) (at <2f3a218dc3d84eeeb8c3162120be0055>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.ReloadPreviousBehavior () (at <2f3a218dc3d84eeeb8c3162120be0055>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnFocus () (at <2f3a218dc3d84eeeb8c3162120be0055>:0)
UnityEditor.HostView.OnFocus () (at <1f0be198f5164d2489de92f22c998266>:0)
 
Adding info on the above, the error only happens when running 2 objects with the same behavior at the same time. It doesn't happen when there is just one.
However, in both situations the debug view doesn't show info.
 
I have created Condtional Task for Behavior tree. It seems the BT is running but the success and failure icons are not displayed as if nothing is running. Please advise

Note : This is happening on any tasks. I can re-install and see that fixes it
 
This sounds related to this post:


What Unity version are you on? Are you able to tell me how to reproduce it?
 
Version : 2022.1.2f1
steps :
1 - Right click on the folder structure un der unity and create a behavior tree.
2 - Add component behavior tree to the gameObject.
3 - Drag behavior tree from folder to the external behavior slot in the component (Behavior tree).

Is that not the correct way to do that ?
 
It looks like this is something related to Unity 2022.1. Thanks for letting me know. I will look into it and fix it for a new release.
 
I've merged the two threads as they are related. After being able to reproduce it I have a fix for it. I'll send you a PM with the new version @kotor, @phuture2k, and @danny100. Thanks for the report! I'll push this version to the Asset Store after I hear that it works for you and I do some more testing.
 
I'm kind of surprised that it does work with that combination but that's good to hear :) The Asset Store says 2018.4 due to an older version upload, the current version doesn't support 2019.4 though I guess the editor portion does still.
 
I encountered an issue that `External Behavior` could not attach to `live debug view` at runtime.
Some external files could work in my project, some of them could not. This issue stucked my workflow...

I have recorded a video to reproduce this issue in a minimal project. Maybe the fix of this minimal case could also work for my actual project(I hope).

SYSTEM:
Unity 2020.3.38f1
Behavior Designer v1.7.3

Steps of text:
1. create a blank unity project
2. import Behavior Designer plugin
3. create a new scene
4. create 2 game object on scene, add `Behavior Tree` component to both of them
5. create an `Internal Behavior Tree` for the first game object, export the result to an `External Behavior Tree` on disk
6. assign the exported external tree to the second game object
7. enter play-mode
8. select these two objects on hierarchy, and observe the `Behavior Designer` Editor
9. The internal one works well, The external one doesn't. (but both the logic of them are correct)

Steps of video:


Important Update to narrow down issue scope:
This issue only happen when external tree doesn't have any variable.(as in video)
If you add a variable to external tree, it works as expectation.
 
Last edited:
Tree visual debugging (green highlighting) doesn't work when using external trees. I can't get it to work in any case on the latest LTS release, 2021.3.14f1.

repro steps:
1. Create a new 2021.3.14f1 project (repro steps tested with both the 3D core and 2D core templates).
2. Import Behavior Designer(current version 1.7.3) from the package manager.
3. Create an empty GameObject in the scene.
4. Add a Behavior Tree component to it.
5. Create a new ExternalBehaviorTree in the assets folder.
6. Assign the ExternalBehaviorTree to the External Behavior field in the new Gameobject's Behavior Tree inspector
7. Tick Log Task Changes in the same inspector.
8. Open The Behavior Designer editor and select the external behavior asset.
9. Add a sequence node.
10. Add 5 wait nodes as children of the sequence node.
11. In the hierarchy, select the Gameobject with the Behavior Tree component.
12. Enter PlayMode.
13. Observe the console: everything is executing correctly.
14. Observe the Behavior Designer editor: no highlighting.

I then removed the external behavior from the Behavior Tree component and created the same tree directly on the GameObject. Highlighting worked perfectly then. For me, it never works with external trees and always works perfectly with trees directly on the GameObjects.

Love the asset so far, just hope this can be resolved because what I am trying to do relies on external trees, and I can't do it without visual debugging.

The first screenshot is made with an external tree, the second screenshot is made with the tree directly on the GameObject.
 

Attachments

  • Screenshot (22).png
    Screenshot (22).png
    302.1 KB · Views: 1
  • Screenshot (24).png
    Screenshot (24).png
    309.8 KB · Views: 1
Top