I’m very new to Unity, and I’m trying to get it to spawn a prefab I made when i click on a tile, and give it the x,y,z coordinates of that tile. I simply can’t get it to work. Can someone help me?
Below is the code i have so far, without the spawning bit.
using UnityEngine;
using System.Collections;
public class tileScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseDown()
{
float xPos = transform.position.x;
float yPos = transform.position.y;
float zPos = transform.position.z;
}
}