Cannot Reproduce
NeedsLoomis 2 months ago • updated by Lazlo Bonin (Lead Developer) 1 month ago 3

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)
Under 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.

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.