Display GUI when enter an area?

When i enter a room how do i make a trigger in that room,

so when i walk in it it displays an onGUI button on screen?

I’m noob at scripting.

thanks in advance.

Make a large box collider with ‘isTrigger’ set to true.

In your ‘OnTriggerEnter’ function, do something like this-

if(collider.gameObject.tag == "Player")
    triggered = true;

and then in your OnGUI-

    // draw something!

Obviously this isn’t completed code, but it should be enough to let you work out the rest.

There are many different ways of doing this.

You can make a cube, give it a tag and flatten it down and then place it on the floor where the player would walk, you can place it right in the beginning of the room. Then just uncheck Mesh Renderer to make it invisible, Then you can use a collider in script and make it something like this:

gameObject.Find(“Your Gui Name”).guiTexture.enabled = false;

function OnControllerColliderHit(hit : ControllerColliderHit)


if(hit.gameObject.tag == “GuiTrigger” )


gameObject.Find(“your GUI name”).guiTexture.enabled = true;



So Basically the Gui is not enabled, but once the player touches the the invisible box the GUI would become enabled and show on screen.

Im Not sure if this will work, but you would do something similar to it. But actually I have a good feeling this is the right code to use and it should work. I would of tested it out but cant at the moment.