Creating and removing HUDs on Collision

I want to be able to create HUD’s on a first person controller collision with objects for example when the user starts they have to find a list of things to fine, a list of those objects appear on the side as HUD’s and when the user finds the item the HUD for that object is removed as it no longer needs to be found.

I also want a map hug to appear in a top corner.

I’m coding in Javascript if that helps :slight_smile:

This is my first project with Unity3D ever, so any help would be awesome, thank you :slight_smile:

http://docs.unity3d.com/Documentation/Components/GUIScriptingGuide.html

http://docs.unity3d.com/Documentation/Components/gui-Basics.html

The first link has links to EVERY GUI control… not just buttons!!! take the time to READ IT, and you may BEGIN to understand

here’s how to do what you ask…

(if this helps you, please be sure and click the check mark to accept my answer)

first, we can create a var to decide whether to show our HUD:

 var showSampleHud : boolean = false;

a boolean is either true or false

now we can set up our GUI:

 function OnGUI(){

 if(showSampleHud){
 GUI.Box(Rect...etc
 GUI.Label(Rect(Screen.width...etc
 GUI.SEE SCRIPTING GUIDE!!!...etc
 }

 }

now all that’s left is the collision:

 function OnCollisionEnter(other : Collider){
 if(other.tag == "showme")
 showSampleHud = true;
 }

of course, your collision will require the proper setup to register, i.e. a collider or character controller on each object, and at least one rigidbody for starters…

Here’s the whole script:

 var showSampleHud : boolean = false;

function OnGUI(){

 if(showSampleHud){
    GUI.Box(Rect...etc
    GUI.Label(Rect(Screen.width...etc
    GUI.SEE SCRIPTING GUIDE!!!...etc
    }
 }
 function OnCollisionEnter(other : Collider){
 if(other.tag == "showme")
 showSampleHud = true;
 }

hope this helps!