Skip to content

Commit 5ea9d4a

Browse files
fix
Delay the sorting of the GhostAdapter and NetworkObjectBridge to avoid from sorting while updating the AssetDatabase.
1 parent b1daa58 commit 5ea9d4a

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -383,19 +383,7 @@ internal void UnifiedValidation()
383383
SynchronizeTransform = false;
384384
}
385385

386-
// Move the bridge to the top
387-
while (UnityEditorInternal.ComponentUtility.MoveComponentUp(NetworkObjectBridge))
388-
{
389-
// Keep moving until it can't go higher
390-
}
391-
392-
// Now move the GhostAdapter to the top so it is above NetworkObjectBridge
393-
while (UnityEditorInternal.ComponentUtility.MoveComponentUp(GhostAdapter))
394-
{
395-
// Keep moving until it can't go higher
396-
}
397-
398-
EditorUtility.SetDirty(gameObject);
386+
EditorApplication.delayCall += SortToTop;
399387

400388
}
401389
else if (HadBridge && !HasGhost && !NetworkObjectBridge)
@@ -404,6 +392,24 @@ internal void UnifiedValidation()
404392
SynchronizeTransform = true;
405393
}
406394
}
395+
396+
397+
private void SortToTop()
398+
{
399+
// Move the bridge to the top
400+
while (UnityEditorInternal.ComponentUtility.MoveComponentUp(NetworkObjectBridge))
401+
{
402+
// Keep moving until it can't go higher
403+
}
404+
405+
// Now move the GhostAdapter to the top so it is above NetworkObjectBridge
406+
while (UnityEditorInternal.ComponentUtility.MoveComponentUp(GhostAdapter))
407+
{
408+
// Keep moving until it can't go higher
409+
}
410+
411+
EditorUtility.SetDirty(gameObject);
412+
}
407413
#endif
408414
#endif
409415
/// <summary>

0 commit comments

Comments
 (0)