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
-1
Question by juniperspark · May 18, 2014 at 02:53 PM · guibuttonguitextureoverlappop-up

Overlapping GUITexture UI Buttons

Hi,

What I have is a UI that will pop up when the user clicks the menu button. The new window will now take up the entire screen and overlay notop of the menu button.

My problem is that when I open the pop up window and I click in the position of the menu button, it still registers that click on the menu button. If I wanted to put a different button in it's place when the window is opened, there is a conflict and both the new button and the menu button would be registered as clicked.

I am using GUITexture for this. Could someone give me some guidance?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Cherno · May 18, 2014 at 03:21 PM

Three things to avoid the overlapping issue:

GUIUtility.hotControl when checking fo the GUI.Button press

Event.current.Use() immediately after the button is pressed

return at the end of the button-press code (just to be sure).

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 juniperspark · May 25, 2014 at 01:40 PM 0
Share

Could you explain to me about using hot.control?

if I have button 1 and 2 overlapping in a new window and my code looks like:

 if(Input.Get$$anonymous$$ouseButtonDown(0) && GUIUtility.hotControl == 0 && button1.guiTexture.HitTest(Input.mousePosition))
 {
 print ("hit button 1");
 }
 
 if(Input.Get$$anonymous$$ouseButtonDown(0) && GUIUtility.hotControl == 0 && button2.guiTexture.HitTest(Input.mousePosition))
 {
 print ("hit button 2");
 }

I am still getting print button 1 + button 2. I want to only have button 1 printed and button 2 printed if I decide to click button 2 separately.

avatar image
1

Answer by getyour411 · May 18, 2014 at 02:54 PM

http://answers.unity3d.com/questions/709639/how-to-make-gui-object-prevent-clickingtouching-wh.html

Also look at GUI.ModalWindow

http://docs.unity3d.com/Documentation/ScriptReference/GUI.ModalWindow.html

Very common question, please search for questions/answers, tuts, vids, code snippets and other resources for additional information.

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

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

button drawn last not triggered 0 Answers

Animate GUI Elements 1 Answer

GUI Button overlap problem 1 Answer

Activate Gui Texture On Trigger Activate 1 Answer

Tic Tac Toe beginner 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