@@ -716,20 +716,20 @@ public static IEnumerator Load(MapInfo mapInfo, string loadPath = "")
716716 }
717717
718718 int progressID = Progress . Start ( "Load: " + loadPath . Split ( '/' ) . Last ( ) , "Preparing Map" , Progress . Options . Sticky ) ;
719- int prefabID = Progress . Start ( "Prefabs" , null , Progress . Options . Sticky , progressID ) ;
720- int prefabID2 = Progress . Start ( "Prefabs" , null , Progress . Options . Sticky , progressID ) ;
721- int pathID = Progress . Start ( "Paths" , null , Progress . Options . Sticky , progressID ) ;
722- int pathID2 = Progress . Start ( "Paths" , null , Progress . Options . Sticky , progressID ) ;
719+ int delPrefab = Progress . Start ( "Prefabs" , null , Progress . Options . Sticky , progressID ) ;
720+ int spwPrefab = Progress . Start ( "Prefabs" , null , Progress . Options . Sticky , progressID ) ;
721+ int delPath = Progress . Start ( "Paths" , null , Progress . Options . Sticky , progressID ) ;
722+ int spwPath = Progress . Start ( "Paths" , null , Progress . Options . Sticky , progressID ) ;
723723 int terrainID = Progress . Start ( "Terrain" , null , Progress . Options . Sticky , progressID ) ;
724724
725725 var splatMapTask = Task . Run ( ( ) => SetSplatMaps ( mapInfo ) ) ;
726726
727- PrefabManager . DeletePrefabs ( PrefabManager . CurrentMapPrefabs , prefabID ) ;
728- PathManager . DeletePaths ( PathManager . CurrentMapPaths , pathID ) ;
727+ PrefabManager . DeletePrefabs ( PrefabManager . CurrentMapPrefabs , delPrefab ) ;
728+ PathManager . DeletePaths ( PathManager . CurrentMapPaths , delPath ) ;
729729 CentreSceneObjects ( mapInfo ) ;
730730 SetTerrain ( mapInfo , terrainID ) ;
731- PrefabManager . SpawnPrefabs ( mapInfo . prefabData , prefabID2 ) ;
732- PathManager . SpawnPaths ( mapInfo . pathData , pathID2 ) ;
731+ PrefabManager . SpawnPrefabs ( mapInfo . prefabData , spwPrefab ) ;
732+ PathManager . SpawnPaths ( mapInfo . pathData , spwPath ) ;
733733
734734 System . Diagnostics . Stopwatch sw = new System . Diagnostics . Stopwatch ( ) ;
735735 sw . Start ( ) ;
@@ -741,8 +741,18 @@ public static IEnumerator Load(MapInfo mapInfo, string loadPath = "")
741741 yield return null ;
742742 }
743743 }
744+
744745 SetLayer ( LandLayer , TerrainTopology . TypeToIndex ( ( int ) TopologyLayer ) ) ; // Sets the alphamaps to the currently selected.
745- yield return null ;
746+
747+ while ( Progress . GetProgressById ( spwPrefab ) . running )
748+ {
749+ if ( sw . Elapsed . TotalMilliseconds > 0.05f )
750+ {
751+ sw . Restart ( ) ;
752+ yield return null ;
753+ }
754+ }
755+
746756 Progress . Report ( progressID , 0.99f , "Loaded" ) ;
747757 Progress . Finish ( progressID , Progress . Status . Succeeded ) ;
748758 }
0 commit comments