Prefab override issue - lost my whole tree

JasonT

Member
- I had a prefab with my main AI tree and I have instances of it in a scene.
- The behaviour tree of the prefab contains shared public variables on the instances.
- I reset the prefab overrides using the 2018.3 prefab override option and I accidentally hit [apply all overrides] instead of Revert. Now my tree has disappeared, only the public variables remain visible in the prefab inspector
- I think the prefab file may still contain the tree as it's still quite large, but the tree is not showing up in the inspector, it just shows the [Add a Task] like it's a fresh Tree.


I'm on 2018.3.9f1 and 2018.3.11
Behviour Designer 1.6.2
 
Last edited:
Also having an issue where if I Open the prefab and change a parameter on the behaviour tree component, and then try to play a scene that uses the prefab, Unity will lock up and crash. Subsequently Unity will continue to lockup and crash if I merely highlight the instance of the prefab in the Scene hierarchy.

Workaround: This does not appear to happen when using an external behaviour script.
 
What does the crash dump look like when Unity crashes? Behavior Designer runs in a managed environment so it should never cause Unity crash - this is likely a bug report for Unity.

Beyond that are you able to list the steps to reproduce the tree being removed when you press override? I'm wanting to see if it's something that is working as intended.

You can see if the tree has any data associated with it by opening the inspector in debug mode and looking at the data field within the behavior tree component.
 
Unfortunately I didn't save the crash logs and now of course I can't seem to repeat the crash since I have already rebuilt the missing tree and I'm also now on 2018.3.11 but it initially got corrupted while on 2018.3.9.

I guess something corrupted the prefab component but I'm not sure what.

I've attached the corrupted prefab incase it's helpful. If I import it in a new project it throws these errors in the console:

ArgumentOutOfRangeException: ArgRange_Array
Parameter name: count
System.Text.UTF8Encoding.InternalGetCharCount (System.Byte[] bytes, Int32 index, Int32 count, UInt32 leftOverBits, UInt32 leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:462)
System.Text.UTF8Encoding.GetCharCount (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:687)
System.Text.Encoding.GetChars (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/Encoding.cs:328)
System.Text.Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/Encoding.cs:751)
System.Text.UTF8Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:1052)
BinaryDeserialization.BytesToString (System.Byte[] bytes, Int32 dataPosition, Int32 dataSize)
BinaryDeserialization.LoadField (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2 fieldIndexMap, System.Type fieldType, System.String fieldName, Int32 hashPrefix, IVariableSource variableSource, System.Object obj, System.Reflection.FieldInfo fieldInfo)
BinaryDeserialization.BytesToSharedVariable (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2 fieldIndexMap, System.Byte[] bytes, Int32 dataPosition, IVariableSource variableSource, Boolean fromField, Int32 hashPrefix)
BinaryDeserialization.LoadField (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2 fieldIndexMap, System.Type fieldType, System.String fieldName, Int32 hashPrefix, IVariableSource variableSource, System.Object obj, System.Reflection.FieldInfo fieldInfo)
BinaryDeserialization.LoadFields (BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.Dictionary`2 fieldIndexMap, System.Object obj, Int32 hashPrefix, IVariableSource variableSource)
BinaryDeserialization.LoadTask (BehaviorDesigner.Runtime.TaskSerializationData taskSerializationData, BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.List`1& taskList, BehaviorDesigner.Runtime.BehaviorSource& behaviorSource)
BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource)
BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource)
BehaviorDesigner.Editor.GraphDesigner.Load (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, Boolean loadPrevBehavior, Vector2 nodePosition)
BehaviorDesigner.Editor.BehaviorDesignerWindow.LoadBehavior (BehaviorDesigner.Runtime.BehaviorSource behaviorSource, Boolean loadPrevBehavior, Boolean inspectorLoad)
BehaviorDesigner.Editor.BehaviorDesignerWindow.UpdateTree (Boolean firstLoad)
BehaviorDesigner.Editor.BehaviorDesignerWindow.OnSelectionChange ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:342)
UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:336)
UnityEditor.HostView.OnSelectionChange () (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:199)
 

Attachments

  • Player Prefab.prefab.zip
    13.5 KB · Views: 1
2018.3.11
1.6.2

This happened again this time while I was editing an external behaviour tree. After I changed something the Tree disappeared and I get the same error in the console when I highlight behaviour tree asset. Still trying to figure out how to repeat this.
 
Based on your sample prefab it looks like when Unity merges the prefabs it is corrupting the binary data. You could try switching to JSON serialization to see if that helps (in the Behavior Designer preferences on the top right of the editor). Alternatively by using external trees then there's no chance of the prefab being corrupted.
 
Top