How to instantiate object at particular location

I have an object called “laucher” which instantiates “spears” every 4 seconds, the spears are supposed to go flying forwards from the launcher until they collide with a wall. however i’m having some problems understanding Instantiate.

This Script is Attached to "Launcher"

using UnityEngine;
using System.Collections;

public class Launcher : MonoBehaviour {

	public GameObject Spear;
	public float counter = 0;

	void Update () {
		if(counter <= 4)
		{
			counter += Time.deltaTime;
		}
		else{
		Instantiate(Spear, new Vector2(-24,0), Quaternion.identity);
		counter = 0;
		}
	}
}

1.) How do I make the spear instantiate at the launcher itself?
2.) How do I properly Instantiate the spear, because right now they’re instantiated as Spear(Clone).

I can’t just use a set location because I have multiple “Launcher” firing “Spear” at different spots of the level.

  1. You can retrieve the current position of the game object containing the actual script by using transform.position.

  2. You are instantiating with the right way, you still can change the name of the created game object.

Try this:

// Instantiate at transform.position
GameObject newSpear = (GameObject)Instantiate(Spear, transform.position, Spear.transform.rotation);
// Change the name
newSpear.name = "Spear";