@@ -74,18 +74,14 @@ public uint PrefabIdHash
7474 internal void RefreshAllPrefabInstances ( )
7575 {
7676 var instanceGlobalId = GlobalObjectId . GetGlobalObjectIdSlow ( this ) ;
77+ NetworkObjectRefreshTool . PrefabNetworkObject = this ;
7778 if ( ! PrefabUtility . IsPartOfAnyPrefab ( this ) || instanceGlobalId . identifierType != k_ImportedAssetObjectType )
7879 {
7980 EditorUtility . DisplayDialog ( "Network Prefab Assets Only" , "This action can only be performed on a network prefab asset." , "Ok" ) ;
8081 return ;
8182 }
8283
8384 // Handle updating the currently active scene
84- var networkObjects = FindObjectsByType < NetworkObject > ( FindObjectsInactive . Include , FindObjectsSortMode . None ) ;
85- foreach ( var networkObject in networkObjects )
86- {
87- networkObject . OnValidate ( ) ;
88- }
8985 NetworkObjectRefreshTool . ProcessActiveScene ( ) ;
9086
9187 // Refresh all build settings scenes
@@ -98,14 +94,14 @@ internal void RefreshAllPrefabInstances()
9894 continue ;
9995 }
10096 // Add the scene to be processed
101- NetworkObjectRefreshTool . ProcessScene ( editorScene . path , false ) ;
97+ NetworkObjectRefreshTool . ProcessScene ( editorScene . path , true ) ;
10298 }
10399
104100 // Process all added scenes
105101 NetworkObjectRefreshTool . ProcessScenes ( ) ;
106102 }
107103
108- private void OnValidate ( )
104+ internal void OnValidate ( )
109105 {
110106 // do NOT regenerate GlobalObjectIdHash for NetworkPrefabs while Editor is in PlayMode
111107 if ( EditorApplication . isPlaying && ! string . IsNullOrEmpty ( gameObject . scene . name ) )
@@ -197,6 +193,7 @@ private void CheckForInScenePlaced()
197193 if ( sourceAsset != null && sourceAsset . GlobalObjectIdHash != 0 && InScenePlacedSourceGlobalObjectIdHash != sourceAsset . GlobalObjectIdHash )
198194 {
199195 InScenePlacedSourceGlobalObjectIdHash = sourceAsset . GlobalObjectIdHash ;
196+ EditorUtility . SetDirty ( this ) ;
200197 }
201198 IsSceneObject = true ;
202199 }
0 commit comments