Hello, I am a experienced programmer but for some reason I can not figure out how to create a simple popup message. I have tried using MessageBox.Show(“”); for a c sharp script. But this was no use. Any help would be greatly appreciated.
External windows are not supported in stand alone builds. In webplayers, you can use external website JavaScript calls to pop up windows.
If you are not really looking for external windows per-se, you should look at the Unity GUI system.
Thanks for the response, does Unity GUI system allow for a form of popup window. I’m basically just trying to display the instructions for the game.
this is wat u r looking for ? Unity - Scripting API: GUI.Window
if it is just instructions this will help for sure…
Yes I have tried that, but even using the given code I get compiler errors.
no way!!! i use thm in my game too…
and one thing about them is, it could be called only inside OnGUI function.
Ok well there stock code works but I’m having a lot of difficulty doing what I wanted. How can I make this react to a click on my graphic? Also, from there how can I code it to have a close button and text inside the window?
Ok I got the code this far, with no errors. However it does not work at all.
You have two overlapping buttons. In UnityGUI GUI.Button both displays the button and registers the click, so:
// Make the contents of the window
function DoMyWindow (windowID : int) {
if (GUI.Button (Rect (10,20,100,20), "Close"))
doWindow0 = false;
}
Awesome thanks for the help. Ok so i got that much working. Now I added the onMouseDown function. However, for some reason, when the game starts the message box is already up.
you need to basically make a true/false flag which you use to tell if the interface is open/game being played.
You will also need to figure the best way to pause your game.
Well, my code already has that. Here is my code:
The only time I know it works is when I add doWindow0 = false into the OnGUI.