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 Vylse · Feb 09, 2012 at 06:00 AM · togglegui.buttongui.window

Can't Get my 2nd Window to Open..

here's my script,I'm only new here,,

var wind1 : Rect = new Rect(65,10,120,60); var wind2 : Rect = new Rect(120,10,100,50); var Win1 = false; var Win2 = false;

var button1 : Rect; var button2 : Rect; var button3 : Rect; var buttonc : Rect; var buttonl : Rect;

var cr8 = true; var lod = false;

function OnGUI() { wind1 = GUI.Window(0,wind1,StartGame,"MMONSG"); }

function StartGame(windowID : int) { GUI.Button(button2,"OPTIONS"); GUI.Button(button3,"QUIT");

 if(GUI.Toggle(button1,Win1,"START GAME","button"))
         {
          Win1 = true;
          wind2 = GUI.Window(1,wind2,CreatePlayer,"LOLO");
          }
          else
          {
          Win1 = false;
          }
    
    

}

function CreatePlayer(windowID : int) {

 GUI.Button(buttonc,"CREATE");
 GUI.Button(buttonl,"LOAD");

}

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Berenger · Feb 09, 2012 at 06:56 AM

First, welcome :)

  • Then, I'm not sure you can call a window from another window function. Maybe you'll need to call them both from OnGUI.

  • And I think you need to store the window ID in a variable (the 0 and the 1).

  • Finally, GUI.Toggle return a bool, so you can do Win1 = GUI.Toggle(...)

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 Vylse · Feb 09, 2012 at 08:24 AM 0
Share

i finally got it to work!! ^_^ thanks!!!

avatar image
0

Answer by Vylse · Feb 09, 2012 at 08:45 AM

thanks! finally got the idea ^_^

Comment
Add comment · 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
0

Answer by Vylse · Feb 09, 2012 at 08:45 AM


function StartGame(windowID : int) {
GUI.Button(button2,"OPTIONS"); GUI.Button(button3,"QUIT");

 if(GUI.Toggle(button1,Win1,"START GAME","button"))
         {
          Win1 = true;
          wind2 = GUI.Window(1,new Rect(120,10,100,50),CreatePlayer,"LOLO"); // i just set the rect instead of calling the var
          }
          else
          {
          Win1 = false;
          }

}

and thanks for the advice ^_^

Comment
Add comment · 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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make GUI.window appear after button click 1 Answer

GUI window + buttons. button click area shifted up on android 0 Answers

How to go to a new gui.window by clicking a gui.button? 1 Answer

Toggling multiple button states 2 Answers

GUI.Button toggling object visibility. 1 Answer


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