11using UnityEngine ;
22using UnityEditor ;
3- using static WorldSerialization ;
43using Unity . EditorCoroutines . Editor ;
54using System . Collections ;
65using System . Collections . Generic ;
76using System . Linq ;
7+ using static WorldSerialization ;
88
99public static class PrefabManager
1010{
@@ -20,11 +20,7 @@ private static void OnProjectLoad()
2020 DefaultPrefab = Resources . Load < GameObject > ( "Prefabs/DefaultPrefab" ) ;
2121 PrefabParent = GameObject . FindGameObjectWithTag ( "Prefabs" ) . transform ;
2222 if ( DefaultPrefab != null && PrefabParent != null )
23- {
2423 EditorApplication . update -= OnProjectLoad ;
25- if ( ! AssetManager . IsInitialised && SettingsManager . LoadBundleOnLaunch )
26- AssetManager . Initialise ( SettingsManager . RustDirectory + SettingsManager . BundlePathExt ) ;
27- }
2824 }
2925 #endregion
3026
@@ -245,6 +241,7 @@ public static IEnumerator SpawnPrefabs(PrefabData[] prefabs, int progressID)
245241 }
246242 Spawn ( Load ( prefabs [ i ] . id ) , prefabs [ i ] , GetParent ( prefabs [ i ] . category ) ) ;
247243 }
244+
248245 Progress . Report ( progressID , 0.99f , "Spawned " + prefabs . Length + " prefabs." ) ;
249246 Progress . Finish ( progressID , Progress . Status . Succeeded ) ;
250247 }
@@ -267,6 +264,7 @@ public static IEnumerator DeletePrefabs(PrefabDataHolder[] prefabs, int progress
267264 }
268265 GameObject . DestroyImmediate ( prefabs [ i ] . gameObject ) ;
269266 }
267+
270268 Progress . Report ( progressID , 0.99f , "Deleted " + prefabs . Length + " prefabs." ) ;
271269 Progress . Finish ( progressID , Progress . Status . Succeeded ) ;
272270 }
@@ -288,6 +286,7 @@ public static IEnumerator ReplaceWithLoaded(PrefabDataHolder[] prefabs, int prog
288286 Spawn ( Load ( prefabs [ i ] . prefabData . id ) , prefabs [ i ] . prefabData , GetParent ( prefabs [ i ] . prefabData . category ) ) ;
289287 GameObject . DestroyImmediate ( prefabs [ i ] . gameObject ) ;
290288 }
289+
291290 Progress . Report ( progressID , 0.99f , "Replaced " + prefabs . Length + " prefabs." ) ;
292291 Progress . Finish ( progressID , Progress . Status . Succeeded ) ;
293292 IsChangingPrefabs = false ;
@@ -310,9 +309,9 @@ public static IEnumerator ReplaceWithDefault(PrefabDataHolder[] prefabs, int pro
310309 Spawn ( DefaultPrefab , prefabs [ i ] . prefabData , GetParent ( prefabs [ i ] . prefabData . category ) ) ;
311310 GameObject . DestroyImmediate ( prefabs [ i ] . gameObject ) ;
312311 }
312+
313313 Progress . Report ( progressID , 0.99f , "Replaced " + prefabs . Length + " prefabs." ) ;
314314 Progress . Finish ( progressID , Progress . Status . Succeeded ) ;
315-
316315 IsChangingPrefabs = false ;
317316 }
318317
0 commit comments