Hello i so far have an object and a code that will make a gui that when you click on it it will make a copy of that object at 0, 0, 0. I would like it so that when i click n the GUI it will make the object at the location of the mouse and i can move my mouse around and the object follows. Can anyone help me with this i have been searching for a while and nothing has helped so far.
This is my code for making the game object-
var btnTexture : Texture;
var prefab : Transform;
function OnGUI() {
if (GUI.Button(Rect(10,60,50,30),"part1")){
for (var i : int = 0;i < 1; i++) {
Instantiate (prefab, Vector3(i * 2.0, 0, 0), Quaternion.identity);
}
}
}