- Home /
Setting the m_PrefabInternal property using the SeriailizedProperty System
Hello!
I have a weird question regarding the Editor and I hope you can help me!
I am loading GameObjects from a Database into the UnityEditor.
I am storing and loading properties by using the SerializedProperty class.
Some of those objects are prefab instances and I would like to recover them Object by Object.
Serialized Unity Objects have a property m_PrefabInternal of type UnityEngine.Prefab that contains the property modifications list.
.
I would like to assign the m_PrefabInternal value by forcing creation of a new instance of UnityEngine.Prefab and then loading the SerializedProperties from the Database. However I have yet to find a way how to do it.
.
I cannot use PrefabUtility.ConnectGameObjectToPrefab as it just deletes my object and creates a new PrefabInstance.
PrefabUtility.InstantiatePrefab does not work as it would require heavy modifications to how my system works and I would like to avoid it at all costs.
PrefabUtility.ReconnectToLastPrefab seems to just fail.
Anyone got any smart ideas on how to achieve that?
I even already tried stealing the value of m_PrefabInternal from another temporary Prefabinstance. That worked - but once the temporary instance gets deleted the stolen UnityEngine.Prefab gets deleted as well.
<3
Cheers Henning
Your answer
![](https://koobas.hobune.stream/wayback/20220612134758im_/https://answers.unity.com/themes/thub/images/avi.jpg)