Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


serializedobject

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
serializedobject [2021/02/23 17:19]
73.95.178.156
serializedobject [2021/10/10 17:59]
artehacker Add a foot note on getting managed references being easier in 2021.2
Line 2: Line 2:
  
 ===== Getting/Setting Managed References ===== ===== Getting/Setting Managed References =====
-Getting a managed reference out of a SerializedProperty is very challenging. It's better to just use C# reflection on the original object and force the asset / object to re-save.+Getting a managed reference out of a SerializedProperty is very challenging((From version 2021.2 on, [[https://docs.unity3d.com/2021.2/Documentation/ScriptReference/SerializedProperty-managedReferenceValue.html|managedReferenceValue]] is not Write Only and can be used to easily get the assigned object.)). It's better to just use C# reflection on the original object and force the asset / object to re-save.
  
-See also+See: 
   * [[https://forum.unity.com/threads/setting-a-serializedproperty-to-a-struct.521752/]]   * [[https://forum.unity.com/threads/setting-a-serializedproperty-to-a-struct.521752/]]
   * [[https://answers.unity.com/questions/1347203/a-smarter-way-to-get-the-type-of-serializedpropert.html]] ((This link has very poor code, but the general approach is correct. It is missing many corner cases, including inheritance and private fields, etc))   * [[https://answers.unity.com/questions/1347203/a-smarter-way-to-get-the-type-of-serializedpropert.html]] ((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