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 robert 4 · Feb 22, 2011 at 06:44 PM · guieventin

Event problem in GUI

var a1 : boolean = false; var a2 : boolean = false; var a3 : boolean = false; var clickCount : int; var ab = 0;

function Start() { a1 = false; }

function OnGUI() { var e : Event = Event.current; if(a1 == true) { GUI.Label(Rect (100, 400, 250, 200),"Mouse clicks: "+ 1 ); }

if(a2 == true) { GUI.Label(Rect (100, 400, 250, 200),"Mouse clicks: "+ 2 ); }

if(a3 == true) { GUI.Label(Rect (100, 500, 250, 200),"Mouse clicks: "+ clickCount ); }

if (e.clickCount == 1 ) { a1 = true; a2 = false; Debug.Log("Mouse clicks: " + e.clickCount); }

if (e.clickCount == 2 ) { a2 = true; a1 = false; Debug.Log("Mouse clicks: " + e.clickCount); }

if (GUI.Button(Rect(8, 8, 128, 64), "BUTTON")) { if (Event.current.type == EventType.MouseDown && Event.current.clickCount ) clickCount +=1; a3 = true; a1 = false; }

}

Here in the first condition when user click on a screen using mouse it will display in label whether it is single or double click.

In the second condition when user click on a gui.button it will display how much number of click is performed on the button using counter.

Here i have used clcikcount event both the condition are working fine my problem is when i click on the button both condition are working.

Here i cannot able to stop the first event condition when i use second event condition i tried to use event.use not working to stop other event.

When user interact with gui.button and only gui.button event should work at that time

What is wrong in this coding

Comment
Add comment · Show 4
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 Eric5h5 · Feb 22, 2011 at 09:06 PM 0
Share

Seriously, stop writing stuff in all-caps.

avatar image robert 4 · Feb 22, 2011 at 09:12 PM 0
Share

how can we stop a event when other event is working

avatar image robert 4 · Feb 23, 2011 at 05:49 PM 0
Share

any body knows what is the wrong in this program

avatar image robert 4 · Feb 23, 2011 at 05:51 PM 0
Share

any anwer to this question

0 Replies

· Add your reply
  • Sort: 

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

Blender like Camera Control Shortcuts 1 Answer

GUI Button sound problem, don´t work 1 Answer

Pause Menu background problem 0 Answers

Game looks messed up when i built it onto my iphone 1 Answer

Quit Game Button Not Working 3 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