Hello, I have my main menu almost finished.
(yay!) There’s just one thing missing. I want to click on my shop, and make a pop up window appear, how would I do this? Here is an example of what I would like to achieve: http://pocketgems.kayako.com/Knowledgebase/Article/View/212/23/secret-passages-pocket-id
Side note; C# preferably.
Hello, hpjohn. This isn’t exactly what I want. I’m looking for something a little more like this: Login - Minecraft Forum
Except I want to click on the “shop” button from my main menu and have it popup a “window” that the players can buy stuff in.
If anyone else can help it would be greatly appreciated.
You can do that easily instantiating some GUITextures and GUIText prefabs : You create prefabs for each of your independant elements that can be the buttons, the window or the texts and you call instantiate for each element when clicking on your “shop button”. Then, in order to “close” the window, you actually need to destroy the prefabs. To do that, create a script with static variables, like “static var myWindowIsOnScreen : boolean = false;” When you click on ur shop button, it must set that static var to true before instantiating the object. Then, on each element of your window, in a script, you put :
function Update(){
if(MyStaticVarsScript.myWindowIsOnScreen == false){
Destroy(this, 0.01);
}
}
Then, the close button only have to set the static var to false in order to destroy the window.
That’s it, with this method you can create custom GUI, You can even add some Scroll function or Drag item with a bit more of scripting.
Edit : the code i’ve put is in Javascript, but it should be as simple in C#
Edit 2 : You could also instantiate your prfabs at the beginning of the level and move them off the screen until the window is opened, which would make them move to the right position. But i personnaly prefer to create and destroy them each time the window is opened/closed.