External Tree Vanish (Empty Editor)

ClaudioTorres

New member
When reporting any bugs please use the following format. This will make it easier for me to understand what is going on so I can fix it.

1. Character controller: Ultimate Character Controller. Using the Third Person Controller for avatars.
2. Unity version: 2019.3.9f1
3. Bug description:
When I save an "external behavior" and add it to my Opsive Character (NOT a prefab), everything works fine.
But at a certain point when I open the external behavior tree at the editor, it shows empty, the tree and variables vanish, and I get an error:

"InvalidCastException: Specified cast is not valid.
BinaryDeserialization.BytesToSharedVariable (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2[TKey,TValue] fieldIndexMap, System.Byte[] bytes, System.Int32 dataPosition, BehaviorDesigner.Runtime.IVariableSource variableSource, System.Boolean fromField, System.Int32 hashPrefix) (at <ddb5579d0d23478c9f73ec2f99600079>:0)
BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <ddb5579d0d23478c9f73ec2f99600079>:0)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (System.Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource) (at <ddb5579d0d23478c9f73ec2f99600079>:0)
BehaviorDesigner.Runtime.BehaviorSource.GetAllVariables () (at <ddb5579d0d23478c9f73ec2f99600079>:0)
BehaviorDesigner.Editor.ExternalBehaviorInspector.DrawInspectorGUI (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, System.Boolean fromInspector, System.Boolean& showVariables) (at <4b28e19850d5443cb0dab9a889df4542>:0)
BehaviorDesigner.Editor.ExternalBehaviorInspector.OnInspectorGUI () (at <4b28e19850d5443cb0dab9a889df4542>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <bf679006b1b84db2a5a44842ef13dc36>:0)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr)"

I can NO longer see my behavior tree or edit it.
I still see that the file size is correct (so the data is there), and my Git shows no change at the file.
Also, if I switch serialization to JSON (instead of binary), all the work is lost. In this case, I see a file size reduction and the Git detect the file change.

Here are the external behaviour tree files https://www.dropbox.com/sh/lrd2x9c4z6o8gkm/AADdj9LF6QuuAbuWjVNhfeRua?dl=0

You can check the files in this folder. The Civilian external tree works fine for now, but the Soldier and Criminal do not open, display empty at the Behaviour Designer Editor and give the above error.

4. Steps to reproduce:
- Create a behavior Tree on an Opsive Third Person Character.
- Add behavior and variables to the tree.
- Export as external behavior.
- Add the new external behavior to the Character Behaviour Tree component "External Behavior Tree".
- Keep working on this scene, play, edit tree, test, and at some point, this error happens.

5. The full error message (if any)

Hi Guys.

I bought the Behaviour Designer some weeks ago on the Unity asset store, together with Opsive Character Controller and it is great.

But now I have a game stopping bug, that is preventing me from using it on my game development.

When I save an "external behavior" and add it to my Opsive Character (NOT a prefab), everything is fine, but in a certain point when I open the external behaviour tree, it shows empty, the tree and variables vanish, and I get an error
"InvalidCastException”.

Using Unity 2019.3.9f1.

If you need it, you can check the files in this folder. The Civilian external tree works fine for now, but the Soldier and Criminal do not open, display empty at the Behaviour Designer Editor and give the above error.

https://www.dropbox.com/sh/lrd2x9c4z6o8gkm/AADdj9LF6QuuAbuWjVNhfeRua?dl=0

Please, I am in time pressure to finalize the AI, and I really need a solution fast.

rds,
 
Thanks,

I already respond.

About send you the working tree not saved to external behavior, how I do that? Seems to be embedded at the component, with no auxiliary file.

Also, looks this is a common question at the forums (where the behavior is stored, and how to backup it, if not external).
 
Claudio must have used a different email because I cannot find that ticket. This post was almost a year ago though so if it required a fix it would have been included in the latest BD version. Make sure you are running version 1.6.8 and if you are can you list the steps to reproduce the exception?
 
Top