Editor Issues

Hey All,
I just started using Behavior Designer for our enemy AI and I am having some issues with the Editor. So far I have had to restart my tree 4-5 times today because the editor gets messed up. Either I get an index out of range error when adding/removing nodes or clicking on the gameobject with the tree component completely locks my Unity Editor, causing it to go unresponsive. I am quite sure this is something I have done because there is no way this would have passed Asset Store QA. Is there anyway to debug/fix these issues? I am currently using the latest version of Behavior Designer and Unity 2019.3.3.
Thanks,
Colton

EDIT: The only thing I did was add an assembly definition to the Behavior Designer folder
 
Last edited:
I think it has something to do with the new prefab system. I have been opening the prefab to edit the tree, but if an error occurs during play mode, the graph on the prefab instance in the scene gets broken and I must drag a new one in.
 
Hey Justin,
Thanks for the prompt response. The main error i'm getting is the following:

IndexOutOfRangeException: Index was outside the bounds of the array.
BehaviorDesigner.Editor.BehaviorDesignerUtility.GetTaskGUIStyle (System.Int32 colorIndex) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.NodeDesigner.DrawNode (UnityEngine.Vector2 offset, System.Boolean drawSelected, System.Boolean disabled) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.GraphDesigner.DrawNodeChildren (BehaviorDesigner.Editor.NodeDesigner nodeDesigner, UnityEngine.Vector2 offset, System.Boolean disabledNode) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.GraphDesigner.DrawNodeChildren (BehaviorDesigner.Editor.NodeDesigner nodeDesigner, UnityEngine.Vector2 offset, System.Boolean disabledNode) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.GraphDesigner.DrawNodes (UnityEngine.Vector2 mousePosition, UnityEngine.Vector2 offset) (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.DrawGraphArea () (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.Draw () (at <d917a79751444cb5b4a389f044c18334>:0)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnGUI () (at <d917a79751444cb5b4a389f044c18334>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <9a184ab867bb42c296d20ace04f48df3>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <9a184ab867bb42c296d20ace04f48df3>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <9a184ab867bb42c296d20ace04f48df3>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <9a184ab867bb42c296d20ace04f48df3>:0)
UnityEditor.DockArea.OldOnGUI () (at <9a184ab867bb42c296d20ace04f48df3>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Boolean canAffectFocus) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

Which occurs every half hour or so. When that happens the graph looks like the attached file. However, if I switch to the prefab, everything about the graph is fine.

Cheers,
Colton
 

Attachments

  • Broken_Graph.PNG
    Broken_Graph.PNG
    17.1 KB · Views: 1
Also seeing issues where I click on the prefab instance in the scene and the graph is just blank, but when I go into the prefab the graph is fine, again causing me to delete the prefab and drag a new one in. Another issue (only happened once so far) every time I clicked on the prefab instance in the scene, the editor locked up and went unresponsive. I had to delete the prefab instance from a script to remove it from the scene and continue working.

EDIT: Now I have a complete disconnect between the prefabs tree and prefab instances tree in the scene (i.e. if I change a setting in the prefab tree it does not change in the scene)
 
Last edited:
If you don't use prefabs does everything work properly? In general I recommend using External Trees instead of storing your tree on a prefab because then you don't have to worry about Unity incorrectly merging the data. They are also extremely useful for sub-dividing the tree.
 
Just posting as an update. The external trees does work much better, but is still far from flawless. Over the last day I have had instances of the editor locking (when enabling game objects with behaviors on them), updating variable names errors (some kind of count error), reflection errors (rare) and loosing comments on nodes within the tree.
Cheers,
Colton
 
Latest issue is:

ArgumentNullException: Value cannot be null.
at System.RuntimeType.GetField (System.String name, System.Reflection.BindingFlags bindingAttr) [0x00003] in <437ba245d8404784b9fbab9b439ac908>:0
at BinaryDeserialization.LoadNodeData (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2[TKey,TValue] fieldIndexMap, BehaviorDesigner.Runtime.Tasks.Task task) [0x00119] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at BinaryDeserialization.LoadTask (BehaviorDesigner.Runtime.TaskSerializationData taskSerializationData, BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.List`1[BehaviorDesigner.Runtime.Tasks.Task]& taskList, BehaviorDesigner.Runtime.BehaviorSource& behaviorSource) [0x00378] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) [0x00268] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) [0x0007a] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at BehaviorDesigner.Runtime.Behavior.CheckForSerialization () [0x00030] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at BehaviorDesigner.Runtime.Behavior.GetVariable (System.String name) [0x00000] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at BehaviorDesigner.Runtime.Behavior.SetVariableValue (System.String name, System.Object value) [0x00000] in <b3033df3de7e4331a53ff33bc57a3e9d>:0
at VitruviusVR.NPC.LightSoldierBehaviourTreeHelper.Start () [0x00001] in E:\rogue-origins\Assets\_Scripts\NPC\LightSoldier\LightSoldierBehaviourTreeHelper.cs:15

Which is causing 10+ min to start playing in the editor. Removing line LightSoldierBehaviourTreeHelper.cs:15 does not help..

EDIT: I am getting approx. 3 of these errors upon entering play (however there are 8 prefabs in the scene, so not all generate an error). If I click on any of the prefabs that generate the error, the editor locks for 5-10 min.
 
Justin, would it be possible to setup a time tomorrow to address these issues (maybe a screen share or something)? As it stands right now this asset is unusable for us and I am concerned with it moving forward.

Cheers,
Colton
 
Hmm, it's strange that you're hitting so many issues. What would help the most is if you can send me a repro scene and the steps to reproduce from that repro scene. This will allow me to look into what the cause is.

The error that you posted is related to serialization - have you tried switching to JSON to see if that helps? You can change it in the top right of the editor.
 
I will work on packaging up a project for you, as I don't want to post it here, where should I send it?

EDIT: I started a conversation with you
 
Last edited:
Top