- Home /
 
 
               Question by 
               RaulG · Jul 28, 2013 at 02:06 AM · 
                spawnienumeratortimespan  
              
 
              Random script activates for a set amount of time
Yeah no clue where to go from here.
Part that spawns them in:
 public IEnumerator Set1()
     {
         if (GameObject.FindGameObjectsWithTag("Platform").Length >= 10)
         {
             yield break;
         }
         for(int a = 0; a < 10; a++)
         {
             PlatformOBJChild = Instantiate(PlatformOBJSel, new Vector3(2.0f+ iX,1.0f+iY,0.0f),
             Quaternion.identity) as Transform;
             iX +=Random.Range(3.0f,6.0f);
             iY +=Random.Range(1.0f,2.0f);
             MaxCount++;
             a++;
             s1++;
             Debug.Log("MaxCount " + MaxCount);
             tList.Add(PlatformOBJChild);
         }
         if(s1 == 10)
         {
             rpSpawn = rPlatSpawn.Next(0,300);
             yield break;
         }
     }
 
               Part that should activate the Sets.
 if (GameObject.FindGameObjectsWithTag("Platform").Length < 10)
         {
             if (rpSpawn <= 100)
             {
                 StartCoroutine(Set1());
             }
 }
 
               Besides the fact it doesn't work for a set amount of time, it spawns in 5 at a time, and breaks through the tList.
Sorry if I didn't give enough information. Ill try to find a way to explain it better.
               Comment
              
 
               
              Your answer