How can I spawn a prefab relative to a cube position?

Good evening everyone, I can not spawn a prefab relative to a cube position, I want to spawn the prefab in position Z+1.
My Script in C#
my prefab is “public GameObject seta1;”

public class regraBlocos : MonoBehaviour {

 

public Vector3 selfPosition;

private bool blocoAtivo = true;

public bool blocoPressionado = false;

public GameObject seta1;

public GameObject seta2;

public GameObject seta3;

public GameObject seta4;

public Vector3 spawnSpot1;

public Vector3 spawnSpot2 = new Vector3(0, 0, 0);

public Vector3 spawnSpot3 = new Vector3(0, 0, 0);

public Vector3 spawnSpot4 = new Vector3(0, 0, 0);

private int pushing = 0;

// Use this for initialization

void Start () {

selfPosition = transform.localPosition;

}

void SpawnSetas(){// regra para spawnar somente uma vez

if (pushing == 0)   {

Instantiate

 

(seta1,transform.localPosition, Quaternion.identity);

 

}

pushing = 1;

}

 

 

// Update is called once per frame

void Update()

 

{

if (Input.GetMouseButtonDown(0) & blocoAtivo ==true)

{

 

RaycastHit hitInfo = new RaycastHit();

bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input .mousePosition), out hitInfo);

if (hit) 

{

if (hitInfo.transform.gameObject.tag == "BLOCO" & blocoAtivo ==true)

{blocoPressionado = true;

SpawnSetas();

} 

//regra se o ray colidir com as tags o bloco se move

if (hitInfo.transform.gameObject.tag == "CIMA" & blocoAtivo ==true)

{transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 1.0f);

blocoAtivo = false;} 

if (hitInfo.transform.gameObject.tag == "DIREITA" & blocoAtivo ==true)

{transform.position = new Vector3(transform.position.x + 1.0f, transform.position.y, transform.position.z);

blocoAtivo = false;} 

if (hitInfo.transform.gameObject.tag == "BAIXO" & blocoAtivo ==true)

{transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z - 1.0f);

blocoAtivo = false;} 

if (hitInfo.transform.gameObject.tag == "ESQUERDA" & blocoAtivo ==true)

{transform.position = new Vector3(transform.position.x - 1.0f, transform.position.y, transform.position.z );

blocoAtivo = false;} 

 

}

}

}

}

Don’t use localPosition: it’s just the object position relative to its parent (if there’s no parent, it’s the same as transform.position). You should use transform.TransformPoint instead:

Instantiate(seta1,transform.TransformPoint(Vector3.forward), Quaternion.identity);

TransformPoint converts the Vector3 passed from local to world space.