title: How to randomly generate GameObjects programmatically?
body: <p>I'd like some help with the following issue. I'm making a simple game where you have a character running and he has to jump over obstacles coming at him.</p>
  
  <p>And I'm currently stuck when it comes to creating GameObjects and randomly generating them within the game scene at run time.</p>
  
  <p>I've written a class to help accomplish this:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class randomObstacles : MonoBehaviour {
  
      public GameObject myCube;
      public Vector3 spawnLocation = new Vector3(0,2,0);
  
      // Use this for initialization
      void Start () {
          GameObject SpawnLocation = (GameObject)Instantiate(myCube, spawnLocation, Quaternion.identity);
      }
  
      // Update is called once per frame
      void Update () {
  
      }
  }
  </code></pre>
  
  <p>The above code is what I wrote to simply create Objects, one after the other. But when I run the game, it comes up empty -_- !</p>
  
  <p>Can anyone please tell me where am going wrong, and from the look of it my code doesn't seem to do what I am hoping to achieve :(</p>
  
  <p>I've attached the above script into an empty GameObject as I saw in a tutorial from the Unity Community forum, but that did not help either.
  (I've looked around and it seems like no one has come across such an issue - I could bee wrong)</p>