Works fine in Editor but on Android... NullReferenceException: Object reference not set to an instance of an object.

millar5001

New member
I am getting a lot of these same errors using Behavior Designer on Android...

Code:
07/28 22:09:31.338 26465 26541 Error Unity: NullReferenceException: Object reference not set to an instance of an object.
07/28 22:09:31.338 26465 26541 Error Unity:   at BehaviorDesigner.Runtime.SharedVariable`1[T].InitializePropertyMapping (BehaviorDesigner.Runtime.BehaviorSource behaviorSource) [0x00000] in <00000000000000000000000000000000>:0
07/28 22:09:31.338 26465 26541 Error Unity:   at 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) [0x00000] in <00000000000000000000000000000000>:0
07/28 22:09:31.338 26465 26541 Error Unity:   at BinaryDeserialization.Load (BehaviorDesigner.Runtime.GlobalVariables globalVariables, System.String version) [0x00000] in <00000000000000000000000000000000>:0
07/28 22:09:31.338 26465 26541 Error Unity:   at BehaviorDesigner.Runtime.GlobalVariables.SetVariable (System.String name, BehaviorDesigner.Runtime.SharedVariable sharedVariable) [0x00000] in <00000000000000000000000000000000>:0
07/28 22:09:31.338 26465 26541 Error Unity:   at OffsideL

It works fine in Unity Editor though.

Android version 2019.2.19
il2cpp and mono
Stripping is off.
Using external behavior trees.
Binary and json.
BD version 1.6.5

Any help would be much appreciated.
 
Last edited:
Also...

Code:
07/28 23:11:26.355 9989 10052 Error Unity: NullReferenceException: Object reference not set to an instance of an object
07/28 23:11:26.355 9989 10052 Error Unity:   at BehaviorDesigner.Runtime.SharedVariable`1[T].InitializePropertyMapping (BehaviorDesigner.Runtime.BehaviorSource behaviorSource) [0x0000a] in <ba143bacb8d5444bbc4c71064e5fe885>:0
07/28 23:11:26.355 9989 10052 Error Unity:   at 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) [0x00218] in <ba143bacb8d5444bbc4c71064e5fe885>:0
07/28 23:11:26.355 9989 10052 Error Unity:   at BinaryDeserialization.Load (BehaviorDesigner.Runtime.GlobalVariables globalVariables, System.String version) [0x001e7] in <ba143bacb8d5444bbc4c71064e5fe885>:0
07/28 23:11:26.355 9989 10052 Error Unity:   at BehaviorDesigner.Runtime.GlobalVariables.CheckForSerialization (System.Boolean force) [0x0006f] in <ba143bacb8d5444bbc4c71064e5fe885>:0
07/28 23:11:26.355 9989 10052 Error Unity:   at BehaviorDesigner.Runtime.GlobalVariables.SetVariable
 
Are you using property mappings with global variables? How did you do that? This won't work because of this issue so you'll need to set them at runtime:

 
For context I have 2 teams of 11 players each in the scene.
Each player on both teams share the same external tree.
The players are in the scene from startup and not loaded from prefabs.
Global variables are only used to help calculate and track each player in the formation.

For some unknown reason it is now working without any property mapping at runtime.

What seemed to work was removing the external behavior from each behavior tree in the scene and then re-add it. At least I think that is what fixed it. Sorry I can't be exact.

Thanks
 
Top