title: Unity C# - 'Instantiate' only accepting "Transform", not 'Vector3' for instantiated object position
body: <p>I'm building a game and have run into a problem. I'm trying to instantiate an object when the "Jump" button is pressed, and I'm trying to give the instantiated object a random position between a specified location. However, my Instantiate function is only accepting a "Transform" variable as it's second argument, and not taking in any Vector3 values for position, as it generally does.</p>
  
  <p>Can anybody please tell me why, and what is the solution to this problem? This is the code: Please note the Instantiate function in the Update function, that's where I'm running into the problem. I'd like to use Vector3 garbagePosition as the second argument. Thanks.</p>
  
  <pre><code>public Transform ground;
  
  public GameObject garbage;
  
  public float loadTime;
  
  public int numberOfObjects;
  
  private Queue&lt;Transform&gt; groundQueue;
  
  public Vector3 startPosition;
  public Vector3 nextPosition;
  
  // Use this for initialization
  void Start () {
  
      nextPosition = startPosition;
      groundQueue = new Queue&lt;Transform&gt;(numberOfObjects);
  
      for(int i = 0; i&lt;numberOfObjects; i++)
      {
          groundQueue.Enqueue((Transform)Instantiate(ground));
      }
  
      for(int j = 0; j&lt;numberOfObjects; j++)
      {
          Recycle();
      }
  
  }
  
  // Update is called once per frame
  void Update () {
  
      if (groundQueue.Peek().localPosition.z + 10 &lt; PlayerScript.playerDistance)
      {
          Recycle();
      }
  
      if (Input.GetButtonDown("Jump"))
  
      {
          Vector3 garbagePosition = new Vector3(Random.Range(-4, 4),
                                                 0.5f,
                                                 PlayerScript.playerDistance + Random.Range(10, 20));
  
          Instantiate(garbage, garbagePosition); 
  
          loadTime += Time.time;
      }
  }
  
  private void Recycle()
  {
      Transform item = groundQueue.Dequeue();
      item.localPosition = nextPosition;
      nextPosition.z += item.localScale.z;
      groundQueue.Enqueue(item);
  }
  </code></pre>
  
  <p>}</p>