- Home /
Popup on collider
How do i go about making a popup the comes up when you walk into an invisable collider that shows information? What im wanting to do is set and invisable collider in a door to a room and when you enter it pops up and you can read text about that room.
there is nothing wrong with this question I think some one is just having fun click down vote.
Nope, wasn't any fun in the downvoting. I did it because pretty much every question I see of yours is always stuff you could have found fairly easily. It's like you don't even bother trying to find it for yourself. If the unity search bar is broken, try google.
You should also get downvoted for spelling a word incorrectly in the title. Unity as far as I know doesn't have a clilider class.
spelling trolls everywhere.... btw if u cant help jus dont reply.
btw regarding the question you have to set a collider without mesh renderer and mark it as trigger.
and in a script override this function "OnTriggerEnter()", inside this function call the code for pop up. for more info on popup check scripting reference.
Answer by Tobster232 · May 19, 2012 at 01:09 PM
Attach this script to the collider:
(make sure your player controller is tagged as 'Player')
var player : GameObject;
private var bool : boolean;
function OnTriggerEnter(other : Collider) {
if(other.tag == "Player") {
bool = true;
}
}
function OnGUI(){
if(bool == true) {
if(GUI.Button (Rect (100, 100, 500, 40), "Message goes here Click to close")) {
Debug.Log("Door Works!");
bool = false;
}
}
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How do i begin with learn scripting. 3 Answers
Need help converting js to C 2 Answers
Converting this JS code to C# 1 Answer