Editor components randomly cause OdinSerializer exceptions in Unity 2022
tracked
Fax
Components sometimes "break" in Unity 2022. They are collapsed, and expanding them reveals nothing. It affects different types of components, i.e. UdonBehaviours or MeshRenderers.
It can be fixed by selecting a different game GameObject.
In my world projects, it's caused by the following error:
ArgumentNullException: Value cannot be null.
Parameter name: unityObject
VRC.Udon.Serialization.OdinSerializer.UnitySerializationUtility.SerializeUnityObject (UnityEngine.Object unityObject, VRC.Udon.Serialization.OdinSerializer.SerializationData& data, System.Boolean serializeUnityFields, VRC.Udon.Serialization.OdinSerializer.SerializationContext context) (at ./Packages/com.vrchat.worlds/Runtime/Udon/Serialization/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1031)
UdonSharp.UdonSharpBehaviour.UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize () (at ./Packages/com.vrchat.worlds/Integrations/UdonSharp/Runtime/UdonSharpBehaviour.cs:272)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
Log In
Teh_Bucket
Still happening on worlds 3.10.3. Client's entire project is nearly-unusable, as every edit to any component on any prefab causes this error, for which the only workaround is to select a different prefab and then select the prefab again to fix the component in inspector. For example, unchecking "Use Gravity" on a rigidbody on a prefab that also has an udonsharp script causes the rigidbody component to be uneditable ("minimized"). I can't find any reason that this has occurred. There is nothing in common between the udonsharp scripts, other than having public variables. If I find any solution I will post it.
Teh_Bucket
Update-
To Reproduce (new project, only worlds SDK via CC):
- Create an empty gameobject in the scene
- Drag it into the project panel to make a prefab
- With prefab selected in the project panel, add any udonsharp script (it can be a new, completely blank udonsharp script)
- This will show the error in console, without additional negative symptoms
- Add a box collider to the prefab (selected in project panel)
- Toggle any setting on the box collider (the negative symptom should appear)
(additional components increase the chance of symptoms happening)
I have tried:
- Rebooting, reinstalling the SDK, reinstalling unity
- Separate unity projects (nothing in common aside from SDK)
- Remaking prefabs (it's just a combination of certain components that breaks it, see reproduction)
Workarounds:
- Editing prefab in scene hierarchy (not project panel)
- Editing prefab in prefab editor (not project panel)
- Selecting a separate object, then the prefab again, every single time you change a value
- Removing all udonsharp behaviors
Odin update required?:
Someone seems to have had the same error, which was patched in a later version (from 2024) than the one included in vrc worlds sdk (from 2022)
ZanyCat
getting a nearly identical error in VRChat SDK - Worlds 3.10.1 when saving a prefab with UdonSharp behaviors.
i get two errors per each udon behavior: one in SerializeUnityObject and one in DeserializeUnityObject.
if a prefab has child variants, then those variants also get updated with errors.
this error occurs whether i save the prefab in prefab edit mode or right click and select "Apply to Prefab".
the error also occurs when a change is made to a script that causes it serialize, e.g. when a public field is added or removed. however, when a change is made that does not affect serialization, then the error doesn't occur.
doesn't matter how many serialized fields are on the Udon behavior, it's always the same two errors.
basically, it seems that any time the prefab has to be serialized by the editor it spits out these errors.
note that this error seems to occur with U# behavior scripts and not with Udon Graph Programs.
doesn't seem to cause any issues with compiling, building or running the udon scripts. it's just a really annoying error that i prefer to not be spamming my logs any time i save my prefabs.
Photo Viewer
View photos in a modal
White Lotuz
marked this post as
tracked
This post was marked as
needs more information
Fax
marked this post as
tracked
Please let us know if you encounter this issue, too!
Teh_Bucket
Please let the team know that I have provided additional information.
TL;DR: an odin update should fix it, and the reproduction steps are above.