Quantcast
Channel: Questions in topic: "javascripting"
Viewing all articles
Browse latest Browse all 105

Help with OnTriggerEnter and mouse down

$
0
0
Hello. I made a script, which in theory should work, but doesn't. I want it to when I click, while in the collider, destroy the prop and display the phone. It's kind of like a fake pick-up system. Please help! PickupPhone.js: #pragma strict var guitext : GUIText; var phone : GameObject; function OnTriggerEnter (other : Collider){ if(other.gameObject.tag == "Player") { guitext.text = "click to pick up the phone"; { if(Input.GetMouseButtonDown(0)){ phone.active = true; Destroy(gameObject); } } } } function OnTriggerExit (other : Collider){ if(other.gameObject.tag == "Player") { guitext.text = ""; } }

Viewing all articles
Browse latest Browse all 105

Trending Articles