I'm trying to get a 3d object to instantiate whenever a 2d plane is clicked. Here is the code:
var wasClicked: boolean = false;
var redBrick: Rigidbody;
function onMouseOver() {
if(Input.GetMouseButtonDown(0)){
wasClicked = true;
var tempRedBrick: Rigidbody;
tempRedBrick = Instantiate(redBrick, transform.position, transform.rotation);
}
}
The code worked on previous game I was making, but I was instantiating 2d planes with each click. Can anyone give me a hand?