This question was
closed Jun 04, 2016 at 06:47 PM by
Puerco-Potter for the following reason:
The question is answered, solved it myself. Needed a mouse.z = 0;
Question by
Puerco-Potter · Jun 05, 2016 at 04:13 PM ·
transformpositioninvisible
Object Disapear when transform position
I am beginning to code on Unity and I was testing. I get and object to move to mouse position when I hold the mouse... in the scene tab, but it disapear in the game tab when I click, I can still see it on Scene. This is what I am doing:
public Vector3 mouse;
public bool press;
void Update () {
press = Input.GetMouseButton(0);
if (press) {
mouse = Camera.main.ScreenToWorldPoint (Input.mousePosition);
transform.position = mouse;
}
}
Comment