0
Cannot Reproduce

​Possible conflict with Odin Inspector

NeedsLoomis 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 5

I've been having a hair pulling issue where my scripts in my state machines keep losing their gameObject references.  I think Ive tracked it down to scripts that inherit from Odin's "SerializedMonoBehaviour".  Looks like every time I change something in one of those scripts, BOLT throws an error and reverts the link to "self".

InvalidOperationException: Missing target object for 'MonoTest.test'.
Ludiq.Member.EnsureReady () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/Member.cs:682)
Ludiq.Member.EnsureInvocable () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/Member.cs:766)
Ludiq.Member.Invoke () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/Member.cs:799)
Bolt.InvokeMember.Invoke () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Framework/Codebase/InvokeMember.cs:146)
Bolt.InvokeMember.Enter (Bolt.Flow flow) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Framework/Codebase/InvokeMember.cs:193)
Bolt.ControlInput.Trigger (Bolt.Flow flow) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Ports/ControlInput.cs:78)
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

I don't have Odin but I intended on grabbing it soon; I'll investigate the issue then.

I'd need you to be more specific about some things though:

  • Are you sure it's only from Odin's scripts?
  • What do you mean by "change something in one of those scripts"?
  • Do you get that error in play mode or in the editor?

Went back to see if I could isolate it further to double check on your first point, and of course I couldn't trigger any issues for an hour...but then it suddenly happened again, and it does appear to be in Odin scripts.

By "change something in a script", its hard to determine, but it seems to be literally anything. For instance, changing my declared string from "Test" to "Test Test" and recompiling did the trick.

I thought it was in play mode only, but upon closer inspection I noticed an error that I had missed this time which did occur in edit mode after updating a script, hopefully it helps:

[Serialization] System.ArgumentNullException: Argument cannot be null.
Parameter name: unityObject
  at Sirenix.Serialization.UnitySerializationUtility.SerializeUnityObject (UnityEngine.Object unityObject, Sirenix.Serialization.SerializationData& data, Boolean serializeUnityFields, Sirenix.Serialization.SerializationContext context) [0x00009] in C:\Users\tor_v\Documents\Projects\Sirenix Development Framework\Sirenix Solution\Sirenix.Serialization\Utilities\UnitySerializationUtility.cs:266 
  at Sirenix.OdinInspector.SerializedMonoBehaviour.UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize () [0x00000] in C:\Users\tor_v\Documents\Projects\Sirenix Development Framework\Sirenix Solution\Sirenix.Serialization\Unity Integration\SerializedMonoBehaviour.cs:31 
  at Ludiq.FullSerializer.fsSerializationCallbackReceiverProcessor.OnBeforeSerialize (System.Type storageType, System.Object instance) [0x00004] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsISerializationCallbacks.cs:116 
  at Ludiq.FullSerializer.fsSerializer.Invoke_OnBeforeSerialize (System.Collections.Generic.List`1 processors, System.Type storageType, System.Object instance) [0x00004] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:1115 
  at Ludiq.FullSerializer.fsSerializer.TrySerialize (System.Type storageType, System.Type overrideConverterType, System.Object instance, Ludiq.FullSerializer.fsData& data) [0x00013] in C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:435 
UnityEngine.Debug:LogWarning(Object, Object)
Ludiq.Serialization:HandleResult(String, fsResult, Object) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:160)
Ludiq.Serialization:SerializeJson(fsSerializer, Object, Boolean) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:129)
Ludiq.Serialization:Serialize(Object, Boolean) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:74)
Ludiq.LudiqBehaviour:UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Unity/LudiqBehaviour.cs:23)
Cannot Reproduce

Hi NeedsLoomis,

Are you still getting this issue with Bolt v.1.0.5 and Odin v.1.0.5.1?

We've both been fixing many issues and this might have been fixed in the way.

If you still have problems, let me know and I'll talk to some of the Sirenix devs directly. Also, please send me a test scene where we can reproduce the bug.

Hey there. I'm just chiming in that I am also getting many serialization errors with the default setup when I have Odin v1.0.5.3 and Bolt v1.2.2, the issue appears to have stemmed from objects in my scene utilizing 

Sirenix.OdinInspector.SerializedMonoBehaviour

That have Dictionaries on them.

If, when you are generating Bolt for first-time use, you have the types listed for:

  • Aot Lists
  • Aot Dictionaries

Then you will encounter these issues whenever you enter/exit play mode in a scene that has utilizes SerializedMonoBehaviour and Lists or Dictionaries that are backed by Odin. In order to see these in the first place, you may have to Reset Defaults on Bolt's type generation step, depending on the order of Add-on installation but it should not be necessary if you install Odin and then Bolt.

This is without any modification of options in Bolt and without changing any configuration settings within Odin, this can be observed by default after installing the two and creating a SerializedMonoBehaviour with a public Dictionary on it.

Please start a new thread and include the error logs. I know the Sirenix guys are also keen to help, but we need the exact errors!