|
I'm trying to understand one line specifically in the pickup script: Pickup Script:
(comments are locked)
|
|
The parameter "col" in OnTriggerEnter is the collider that collides with your trigger. This collider is attached to another GameObject. GetComponent search for another Component on this GameObject. You have to tell GetComponent what type of component you're searching for. In this case you want the ThirdPersonStatus script.
checks whether GetComponent have found a component of this type or not. With this reference you can access public variables or functions of that ThirdPersonStatus script.
I hope that clears it up a bit ;)
(comments are locked)
|
|
I added a cube to the Lerpz world, and onto it the following onGUI/onTrigger functions. Thanks for your help, Bunny83. Please refer to the following: var trigger1: boolean = false; function OnGUI(){ if (trigger1){ GUI.Label(Rect(0,0,50,50), "Hello",""); } } function OnTriggerEnter (col : Collider) { Debug.Log(col.name); if (col.name == "Cube") trigger1 = true; }
(comments are locked)
|

Well, wouldn't it be better if you post your script instead of this one? Why do you referring to OnGUI? That have nothing to do with collisions at all. Edit your question if you want to change/add something. I've also fixed your code highlighting. Take a look at the editing help: http://answers.unity3d.com/editing-help And, of course if you haven't already, the FAQs http://answers.unity3d.com/faq