Hi there!
I want to click on a GameObject that “activates” the spawn and then click again in another GameObject and spawn the object where I clicked (The last time). (Sorry for bad explanation, my english is pretty bad…)
I’ve got this code, that makes spawn the prefab on the 1st GameObject, I don’t even know how to begin.
public class InstancePlayer : MonoBehaviour {
public GameObject player;
int i = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseDown() {
if (Input.GetMouseButtonDown(0) && (i<11)){
Instantiate(player, transform.position, Quaternion.identity);
Debug.Log ("Player:" + i);
i++;
}
}
}
Thank you!