title: for the HEX puzzle game, the objects spawn on top of each other
body: <p>I'm doing a HEX puzzle game.But the problem is that the objects that spawn are overlapping because I'm random and I want to delete the objects that overlap and sort them as in the picture, but I couldn't.I'm using the unity gaming engine.You can help in this regard?</p>
  
  <pre><code>void Update()
  {
          StartCoroutine(Create());
  
  }
  
  
  
  IEnumerator Create()
  {
      yield return new WaitForSeconds(start_standby);
      while (true)
      {
  
          for (int i = 0; i &lt; 10; i++)
          {
              if (randHexagon &lt;= 5)
              {
                  Vector3 vec = new Vector3(Random.Range(-randomPos.x, randomPos.x), Random.Range(-randomPos.y, randomPos.y), 0);
                  Instantiate(spawnObject[randHexagon], vec, Quaternion.identity);
  
              }
  
  
                  yield return new WaitForSeconds(create_wait);
  
  
          }
  
          yield return new WaitForSeconds(loop_wait);
          if (finishGame)
          {
              returnStart = true;
              break;
          }
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>the result is that Hexagon, which is composed of sequential and random colors, is supposed to occur on the screen, but the Hexagon, which is formed, comes in a row and does not come in a straight line.</p>