title: How to spawn random 2D platforms that do not overlap in Unity?
body: <p>I'm looking for a way to randomly spawn platforms that do not overlap with each other. All the tutorials I found on this topic are for an endless runner game type, and my project is not like that. So far I know how to spawn my platforms but I need those gaps between them. I'm a total begginer in Unity and C# so I'm looking for a simple code if possible. </p>
  
  <p>My code now:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
   public class GameStateManager: MonoBehaviour {
  public GameObject YellowPrefab;
      public int howManyYellow;
  
   void Start()
      { GameObject tmpYellow;
  
          for (int i = 0; i &lt; howManyYellow; i++)
          {
              tmpYellow = Instantiate(YellowPrefab, new
                          Vector3(Random.Range(-50, 50), Random.Range(-
                          40, -17), 0), Quaternion.identity);
          }
   }
  </code></pre>
  
  <p>My platforms have box colliders used by platform effector, if that information is needed.</p>
  
  <p>Edit:
  If possible, it would be nice to be able to set max distance between the random platforms, but if it's something hard to do with that kind of code then it's OK without that:)</p>