in the mini challenge , i have used scene.isDirty which return bool if the scene has changed so that in a prefab situation the scene wouldn’t change and the unique Identifier will be empty. i tried it and it worked as intended.So is that a good approach?
#if (UNITY_EDITOR)
// your code here
void Update() {
if(Application.IsPlaying(gameObject)) return;
if(this.gameObject.scene.isDirty)
{
SerializedObject serializedObject = new SerializedObject(this);
SerializedProperty property = serializedObject.FindProperty("uniqueIdentifier");
if(String.IsNullOrEmpty(property.stringValue))
{
property.stringValue = System.Guid.NewGuid().ToString();
serializedObject.ApplyModifiedProperties();
}
}
}
#endif```