Sequential Coroutines sometimes halt

Hello, I’ve been working on improving my Dissertation Project from University.

This game creates a bunch of rooms, so ive been implementing Coroutines to create the map over time, rather than just in methods executed from the Start method.

Problem is majority of the time, all the map is created; dandy.

However sometimes only a percentage of it is, and its different each time.

Here is my output:

Not Desktop Application
MapModeManager.start
About to run CoR - createBlankMap
Creating Blank Room: 0, 0
Creating Blank Room: 0, 1
...
Creating Blank Room: 8, 9
Finished creating Blank Rooms
About to run CoR - createMap
About to read from File :
/storage/emulated/0/Android/data/com.IFaBb.ModularZombieSurvival/files/SaveFiles/Blarg.txt
Not new File (skipping dims)
Loop Spawn Rooms; 9, 10
roomScript.roomConfig(DifferentRooms[0], ID:0, Rot:0, X:0, Z:0);
Finished Configuring Room: 0, 0
roomScript.roomConfig(DifferentRooms[0], ID:0, Rot:0, X:0, Z:1);
...
Finished Configuring Room: 6, 0
roomScript.roomConfig(DifferentRooms[0], ID:0, Rot:0, X:6, Z:1);
Finished Configuring Room: 6, 1
roomScript.roomConfig(DifferentRooms[0], ID:0, Rot:0, X:6, Z:2);

End of Output

So the problem here, is that all the Blank Root rooms are created, but the program stopped at Room 6,1 when giving each the appropriate room.

I either need advice on how to sort out the code concept below, which is to spawn all the roots, then the rooms, and then config them.
AND/OR
A way to do sequential CoR excutions, that each one is able to perform 2 for loops, and stop itself and then resume at the end of each, ie:

for(){
for(){

//do stuff

}
//jump out for now (yield) and resume next time CoR runs
}

CODE (unimportant content removed)

using UnityEngine;
using System.Collections;

using System.Collections.Generic;
using System.IO;

public class MapModeManager : MonoBehaviour {
	
	//Variables
	
	//==============================================================================================================
	/*Use this for initialization
	 */
	void Start () {

		MyDebug.log("MapModeManager.start");

		StartCoroutine( coStart() );

	}//Start

	//==============================================================================================================
	IEnumerator coStart(){
	
		MyDebug.log("About to run CoR - createBlankMap");
		yield return StartCoroutine( createBlankMap() );

		MyDebug.log("About to run CoR - createMap");
		yield return StartCoroutine( createMap() );

		MyDebug.log("About to run CoR - activateNMs");
		yield return StartCoroutine( activateNMs() );


		if( !SaveMemory.isEditMode() ){
			MyDebug.log("Activating AI Manager");
			gameObject.transform.GetComponent<AI_Manager>().enabled = true;//enable AI script
			gameObject.transform.GetComponent<AI_Manager>().activate();//run startup stuff
		}else{
			MyDebug.log("Not, Activating AI Manager");
		}

		yield return null;

	}


	//==============================================================================================================
	IEnumerator createBlankMap(){
		
		for(int x=0; x<roomsX; x++)
		{
			for(int z=0; z<roomsZ; z++)
			{
				MyDebug.log("Creating Blank Room: "+x+", "+z);

				if( startingTemplateRoom == null ){
					MyDebug.log("StartingTemplateRoom == Null");
				}else{
					Debug.Log("StartingTemplateRoom, Exists");
				}

				Rooms[x,z] = Instantiate( startingTemplateRoom,
				                         new Vector3( (float)x*spawnRoomSize,0f, (float)z*spawnRoomSize  ) ,
				                         Quaternion.identity ) as GameObject;
				
			}//for
			
			yield return null;
			
		}//for

		MyDebug.log("Finished creating Blank Rooms");

		yield return null;

	}//IE createBlankMap


	//==============================================================================================================
	IEnumerator createMap(){

		//set Room Size
		Room roomScript;
		int roomID, roomRot;
		
		MyDebug.log("About to read from File :");
		MyDebug.log(SaveMemory.getDesiredFile(true) );
		
		using( StreamReader sr = new StreamReader( SaveMemory.getDesiredFile(true) ) ){
			
			
			MyDebug.log("Loop Spawn Rooms; "+roomsX+", "+roomsZ);
			//initializes Rooms
			for(int x=0; x<roomsX; x++){
				for(int z=0; z<roomsZ; z++){
					//------
					
					roomScript = Rooms[x,z].GetComponent<Room>();
					
					if( !SaveMemory.isNewFile() ){
						string Temp = (sr.ReadLine()).ToString();
						//Debug.Log("First Reading as String is :"+Temp);
						roomID = int.Parse( Temp );
						Temp = (sr.ReadLine()).ToString();
						//Debug.Log("First Reading as String is :"+Temp);
						roomRot= int.Parse( Temp );
						
						MyDebug.log("roomScript.roomConfig(DifferentRooms["+roomID+"], ID:"+roomID+", Rot:"+roomRot+", X:"+x+", Z:"+z+");");
						
						roomScript.roomConfig(DifferentRooms[roomID],roomID,roomRot, x, z);
						
					}else{
						MyDebug.log( "Creating Basic Room" );
						roomScript.roomConfig(DifferentRooms[0],0,0, x, z);
					}

				}//for

				yield return null;

				//Debug.Log("Row :"+x);
			}//for
		}//using

		MyDebug.log("CoR createMap, Finished");
		finishedSpawning = true;

		yield return null;

	}//IE createMap


	//==============================================================================================================
	IEnumerator activateNMs(){

		bool activateFinished = false;

		for(int x=0; x<roomsX; x++)
		{
			for(int z=0; z<roomsZ; z++)
			{
				activateFinished = Rooms[x,z].GetComponent<Room>().activateNM();
			}

			yield return null;

		}//for


		MyDebug.log("About to Spawn Player Model");
		if( editMode ){
			
			if( DesktopApplication ){
				Instantiate( EditorPlayer, 			spawnPlayerPos.transform.position, Quaternion.identity);
			}else
			{
				Instantiate( EditorPlayerMobile, 	spawnPlayerPos.transform.position, Quaternion.identity);
			}
		}else{
			if( DesktopApplication ){
				Instantiate( CombatPlayer, 			spawnPlayerPos.transform.position, Quaternion.identity);
			}else
			{
				Instantiate( CombatPlayerMobile, 	spawnPlayerPos.transform.position, Quaternion.identity);
			}
		}//editMode
		Destroy(tempCamera);

		MyDebug.log("Have spawned Player");

		yield return null;
		
	}//activateNMs
	
	
	//==============================================================================================================
	// Update is called once per frame
	void Update () {


	}//Update
	
}//CLASS

CODE Ends

Any and all help is welcome, and I will answer any and all questions if there are any.

Ok im going to put a closing Answer on this.

Firstly CoR are a bit odd at first I thought they were exiting early, but turns out I missed an error I had.

I have a method called “GetScripts” which as the name says, gets the PathNode and NodeManager scripts for the room.

I hadn’t worked with all the code for sometime and had been working on other areas, I didnt realise that GetScripts was restricting its operation depending on gamemode.

From this I wont be forgetting or making the mistakes I had made when making the game, so no worries.

public void getScripts(){

		if( !SaveMenory.isEditMode ){

			Debug.Log("Getting Scripts");

			if( theRoom.GetComponent<PathNode>() != null ){
				PathingNode = theRoom.GetComponent<PathNode>();
				//Debug.Log("Room.Grabbing PathNode");
			}
			if(PathingNode == null){
				MyDebug.log("Room ["+roomX+","+roomZ+"] PathNode is still NULL!");
			}

			if( theRoom.GetComponent<NodeManager>() != null ){
				NodeMan = theRoom.GetComponent<NodeManager>();
				//Debug.Log("Room.Grabbing NodeManager");
			}
			if(NodeMan == null){
				MyDebug.log("Room ["+roomX+","+roomZ+"] NodeMan is still NULL!");
			}
		
		}else{

			//Debug.Log("EditMode; not grabbing Scripts");
			BroadcastMessage("disablePlayModeAspects",SendMessageOptions.DontRequireReceiver);
		
		}
		
	}//getScripts