Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Michael 12 · Nov 20, 2011 at 11:13 PM · pop-upgui-window

Popup window for individual game objects

OK I think I've got the problem licked here is my code just incase anyone else is pulling out their hair trying to do this... not sure if it's the correct way to handle this but it seems to be working ok:

Now I wonder if I could trouble someone to tell me how to freeze my background while my pop up window is open & then unfreeze when it's closed but still keep my background music playing lol

     var windowRect : Rect = Rect (20, 20, 120, 50);
 
 var doWindow0 : boolean = false;
 
 
 
 var aTexture : Texture;
 
 
 
 function OnGUI () {
 
 GUI.backgroundColor = Color.black;
 
 GUI.contentColor = Color.yellow;
 
 
 
 
 
 
 
 
 
 
 
 // Make sure we only call GUI.Window if doWindow0 is true.
 
 if (doWindow0)
 
 GUI.Window (0, Rect (350,250,800,500), DoMyWindow, "Suicide of T-Bear T-Shirt.");
 
 }
 
 
 
 // Make the contents of the window
 
 function DoMyWindow (windowID : int) {
 
 
 
 //I need to place a photo of the product here somehow?
 
 
 
 
 
 if(!aTexture){
 
 Debug.LogError("Assign a Texture in the inspector.");
 
 return;
 
 }
 
 GUI.DrawTexture(Rect(10,70,402,402), aTexture);
 
 
 
 
 
 
 
 // This is where I add my descriptive product text NOTE: Be sure to include the "\n" in between your lines of text
 
 
 
 var stringToEdit : String = "The attempted suicide of T. Bear T-Shirt\nInspird by a T.V. episode of Supernatural";
 
 stringToEdit = GUI.TextArea(Rect(425,75,360,300), stringToEdit, 200);
 
 
 
 
 
 
 
 
 
 if (GUI.Button( Rect(690,450.5,75,25),"Buy It")) {
 
 Application.OpenURL("http://www.zazzle.com/t_bear_suicide_t_shirt-235455214631112735");
 
 }
 
 
 
 if (GUI.Button (Rect (680,20,100,20), "Close"))
 
 doWindow0 = false;
 
 
 
 }
 
 
 
 function OnMouseDown()
 
 {
 
 doWindow0 = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 } 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ks13 · Dec 01, 2011 at 03:12 PM

It's quite possible to do something like that with GUI.
First you'll need a way to tell your pop-up window what to show. To do this you have several was, among which the following two :
- Make a global variable containing the information you will fetch when you load your information window.
- Pass the information as a parameter to the function that will build your information window.
Next you'll need to think what your window will look like, it's easier to make a formated window where only the text, image or links change rather than making a different looking window for each object.
After that, images are plain textures, so you can easily put a texture on a GUI element.
As for external links opening in a browser, you migh want to check this page.
I think everything i taked about is accessible in the free version of Unity, so you should be able to do it.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Michael 12 · Dec 01, 2011 at 04:24 PM 0
Share

Thanks ks13, is there a tutorial or something on how to do this? yes all of my windows indeed should look the same just lke in my sketch, all I should need to do for each is update the product photo, descriptive text and the web link on the button. But yeah, somekind of tutorial on how to do this would be great, been looking all week and can't find anything that shows how to do this. I'm not a coder so I need a visual lol

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Launch Web browser & web site from GUI 1 Answer

Pop Up GUI Windows & Screen Lock Cursor Question 1 Answer

GUI controls inside a window are disabled for unknown reason 1 Answer

One level, many Pop-up... 1 Answer

Just downloaded Unity and my 30-day trial is already expired? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges