Example: when adding a GuidComponent to a prefab, prefab instances in Scenes will be modified, but the Scene will appear unmodified. Adding Undo.RecordObject before every call to CreateGuid resolves the issue for me:
In GuidComponent.cs, add the following:
void Awake()
{
Undo.RecordObject(this, "Update GUIDs in Scene");
CreateGuid();
}
void OnValidate()
{
Undo.RecordObject(this, "Update GUIDs in Scene");
#if UNITY_EDITOR
Example: when adding a
GuidComponent
to a prefab, prefab instances in Scenes will be modified, but the Scene will appear unmodified. AddingUndo.RecordObject
before every call toCreateGuid
resolves the issue for me:In
GuidComponent.cs
, add the following: