Skip to content

Commit 7cb5794

Browse files
author
Benoit Hudson
committed
Eliminate an optimization that caused an event not to fire.
OnUpdate wasn't getting called if there was no reparenting or component update work to do -- but ProBuilder needs it even if it's just about meshes getting updated.
1 parent 5219dac commit 7cb5794

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Assets/FbxExporters/FbxPrefab.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -907,21 +907,18 @@ void CompareAndUpdate()
907907
// First write down what we want to do.
908908
var updates = new UpdateList(GetFbxHistory(), m_fbxModel.transform, this);
909909

910-
// If we don't need to do anything, jump out now.
911-
if (!updates.NeedsUpdates()) {
912-
Log("{0}: no updates needed", transform.name);
913-
return;
914-
}
915-
916-
// We want to do something, so instantiate the prefab, work on the instance, then copy back.
910+
// Instantiate the prefab, work on the instance, then copy back.
911+
// We could optimize this out if we had nothing to do, but then the
912+
// OnUpdate handler wouldn't always get called, and that makes for
913+
// confusing API.
917914
var prefabInstance = UnityEditor.PrefabUtility.InstantiatePrefab(this.gameObject) as GameObject;
918915
if (!prefabInstance) {
919916
throw new System.Exception(string.Format("Failed to instantiate {0}; is it really a prefab?",
920917
this.gameObject));
921918
}
922919
var fbxPrefabInstance = prefabInstance.GetComponent<FbxPrefab>();
923920

924-
// Do ALL the things!
921+
// Do ALL the things (potentially nothing).
925922
var updatedObjects = updates.ImplementUpdates(fbxPrefabInstance);
926923

927924
// Tell listeners about it. They're free to make adjustments now.

0 commit comments

Comments
 (0)