- Home /
How do i spawn in a prefab with a x,y,z location?
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;
         
     }
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by ArkaneX · Sep 18, 2013 at 10:52 PM
Please read official documentation page related to instantiating. It describes the process step by step.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                