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 Ash · Jun 10, 2010 at 09:38 AM · guiboxmessage

GUI Message Box Handling

With the unity GUI I have created a message box via BeginGroup etc.

But Im wondering what is the best way for this to capture all the input so that no other controls can be used until this messagebox has been handled?

So that the game (all other GUI controls) essentially waits for a response in this message box.

Ashley.

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
1

Answer by qJake · Jun 10, 2010 at 10:04 AM

Just turn off all the other GUI controls so the message box is the only one shown. There is currently no way to make a part of a GUI Modal.

Something like this:

bool MessageBox = false;

void OnGUI() { if(MessageBox) { // Message Box GUI Code } else { // Regular GUI Code } }

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
1

Answer by filixix · Apr 14, 2011 at 12:03 AM

hi everyone! Greetings from Lisbon!

Talking about MessageBoxes a doubt came up:

is there any way to have something like this bilt on a webplayer?

if (UnityEditor.EditorUtility.DisplayDialog(title, body, "Yes", "No"))
    print ("Yes");    
else
    print ("No");

I mean: is there any easy way to do it without having to draw GUI.Box, GUI.TextArea and GUI.Buttons and use a boolean to let you know the dialog is still open?

Thank you all

Edit: I'm going to open a new post with this question (20-04-2011)

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 newbrand · Jun 10, 2010 at 10:12 AM

Normally you could use a box big enough to fill the screen and then show your message box. However, this doesn't work because the unity GUI has a nasty bug that allows gui elements that are behind other gui elements to still receive user input like clicks or mouse hovers.

Because of this behaviour it is probably the best and definitely the easiest solution to use a variable isModalDialogShowing: boolean that is visible from all scripts. If you want to show a modal dialog like your message box, set it to true and don't handle any other user input or show gui elements unless isModalDialogShowing is false.

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

No one has followed this question yet.

Related Questions

Help With Message System Script 1 Answer

GUI box problem? 0 Answers

Change colour of GUI box, keep round corners. 0 Answers

Converting world coordinates to screen coordinates 1 Answer

Android Messag 0 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