Quantcast
Channel: Latest Questions by secondry2
Viewing all articles
Browse latest Browse all 28

Collider Script Not Detecting

$
0
0
Hello! I've got this script to detect whether the player has picked up an item, and heres the deal: I have a paper entity I imported, and I added a sphere collider, to it, and if the box is trigger is not checked, nothing happens, and the player can move through the paper, and if the is trigger box is checked, the paper never appears, and it says I have one paper. Im new to unity, so forgive some silly mistakes :) var Paper : int = 0; var paperToWin : int = 8; function Start() { } function Update() { } function OnTriggerEnter( other : Collider ) { // Debug.Log("Triggered by [tag] : " + other.gameObject.tag); // Debug.Log("Triggered by [name] : " + other.gameObject.name); //if (other.gameObject.tag == "dirt"){ Paper += 1; Debug.Log(Paper + "/8 Collected"); Destroy(other.gameObject); //} } function OnGUI() { if (Paper < paperToWin) { GUI.Box(Rect((Screen.width/2)-100, 10, 200, 35), "" + Paper + "/8 Collected"); } else { GUI.Box(Rect((Screen.width/2)-100, 10, 200, 35), "All Papers Collected!"); } } EDIT: I forgot to mention! The script is a child of the first person controller!

Viewing all articles
Browse latest Browse all 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>