Object spawning at incorrect Y value.

So, I am trying to write a script to shoot an arrow forward from my ArrowSpawn GameObject, which is a small sphere with no mesh/colliders that is attatched to my Character, and stays infront of him… The original GameObject for the Arrow I have hidden under the map, because in order for the script to reference it to instantiate, it has to be in the scene.

The problem is, it spawn the arrow on the same Y level as the Arrow I have hidden below, with all of my other GameObjects that are Projectiles. (I have yet to make a projectile script yet, but I have numerous projectile models)

Here’s the script, perhaps you can help me get it to spawn on the same Y position as the ArrowSpawn Sphere.

using UnityEngine;
using System.Collections;

public class AttackHandler : MonoBehaviour {
      	public Transform arrowPrefab;
		GameObject arrow = GameObject.FindGameObjectWithTag("Arrow");
	
	void Start () {
		arrowPrefab = arrow.transform;
	}
	
	// Update is called once per frame
	void Update() {
        if (Input.GetKeyUp(KeyCode.Space)) {
			Instantiate (arrowPrefab, GameObject.Find("ArrowSpawn").transform.position, Quaternion.identity);
		}
	}
}

Editing to bump

I’m not sure why your arrow is in the wrong place, but there are some things that are a bit strange from what I normally see. Here is a rewrite of a script that should do what you want:

using UnityEngine;
using System.Collections;

public class ArrowSpawnDebug : MonoBehaviour {
       public GameObject arrowPrefab;
       private GameObject goSpawnPoint;
 
    void Start () {
       goSpawnPoint = GameObject.Find("ArrowSpawn");
    }
 
    // Update is called once per frame
    void Update() {
        if (Input.GetKeyUp(KeyCode.Space)) {
           GameObject go = (GameObject)Instantiate (arrowPrefab, goSpawnPoint.transform.position, goSpawnPoint.transform.rotation);
			
			// And to fire the arrow uncomment next line
		   //go.rigidbody.AddRelativeForce(Vector3.forward*1000);
       }
    }
}

To initialize ‘arrowPrefab’ you select the game object with this script attached, then you drag and drop the arrow from the scene (or from a prefab) onto the ‘arrowPrefab’ variable in the inspector. If you want to fire the arrow, it must have a rigidbody component.