Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


serializedobject

SerializedObject

Getting/Setting Managed References

Getting a managed reference out of a SerializedProperty is very challenging1). It's better to just use C# reflection on the original object and force the asset / object to re-save.

See:

1)
From version 2021.2 on, managedReferenceValue is not Write Only and can be used to easily get the assigned object.
2)
This link has very poor code, but the general approach is correct. It is missing many corner cases, including inheritance and private fields, etc
serializedobject.txt · Last modified: 2021/10/10 17:59 by artehacker