title: How to calculate the distance between array gameObject?
body: <p>How to calculate the distance between the generated cubes. The assigned script on the dice only specifies a different speed. How is the distance between the individual instantiate cubes calculated?
  Sorry for the bad English, I'm using google trnslator. I'm attaching the code, and I'm a beginner in the unit</p>
  
  <pre class="lang-c# prettyprint-override"><code>public class vehicless : MonoBehaviour 
  {
      [SerializeField] private GameObject[] vehicle;
      [SerializeField] private Transform spawnPos;
      [SerializeField] private float minTime;
      [SerializeField] private float maxTime;
  
      int randomInt;
  
      // Use this for initialization
      void Start () 
      {
          StartCoroutine(SpawnVehicle()); 
      }
  
      // Update is called once per frame
      void Update () 
      {   
      }
  
      private IEnumerator  SpawnVehicle()
      {
          int i=1;        
          while(true)
          {     
              randomInt = Random.Range(0,vehicle.Length);
  
              yield return new WaitForSeconds(Random.Range(minTime,maxTime));
  
              GameObject myPrefabInstance = Instantiate(vehicle[randomInt],spawnPos.position,Quaternion.identity);
              var red =   myPrefabInstance.gameObject.name; //NAME OBJECT
               var  namecube  = red + i ;
               Debug.Log("Name object:"+namecube ) ;   
               i++;
           }
      } 
  }   
  
  
  //  float   dist = Vector3.Distance(----------);
  </code></pre>
  
  <p>Thanks for help</p>