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 GKdev1980 · Apr 02, 2014 at 12:09 PM · buttonstouchscreen

Isolate screen taps from button clicks

I'm counting screen taps in my app using (Input.touchCount == 1 && Input.GetTouch (0).phase == TouchPhase.Ended))

I also have some buttons in my interface, I used both OnGUI buttons, as well as NGUI buttons with box colliders.

Is there any way to exclude tap counts when pressing on the buttons?

Comment
Add comment · Show 6
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 flamy · Apr 02, 2014 at 12:14 PM 0
Share

If i remember correctly NGUI has its own Events for inputs, it would be better to use them for checking inputs if you want to stick to NGUI. search for it in NGUI forums, you would get something for sure!.

avatar image GKdev1980 · Apr 02, 2014 at 12:17 PM 0
Share

I wouldn't want to change too much of my code at this point, I'm going to check NGUI in more detail in later projects, could I use different layers to use in my conditions?

avatar image Gruffy · Apr 02, 2014 at 01:16 PM 0
Share

//the below lets you check for the back button on android and IOS as I understand it. //so making some of the se up and finding their common/standard references like...

 if(Input.Get$$anonymous$$ey($$anonymous$$eyCode.Escape))
 {
 //then something along the lines of...
 Input.touchCount = 0;  //make touches not equal to 1 ensuring your tap count is not incremented
 }

Just in case, here is there $$anonymous$$eyCode list for Unity and you will most likely find that like "$$anonymous$$eyCode.Escape" you can access your other buttons similarly.

If this question is referring to GUI buttons, then the same principle would apply, making Input.touchCount equal to 0 when you press a gui button etc. Take care hope that helps some. Gruffy

avatar image Gruffy · Apr 02, 2014 at 04:59 PM 0
Share

yes, different layers are possible using GUI.Layer. Cheers bud Gruffy

avatar image GKdev1980 · Apr 03, 2014 at 08:45 PM 0
Share

Hmmm.. How exactly is checking for the escape button going to help me with my issue?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kamuiyshirou · Apr 03, 2014 at 09:27 PM

It's not hard. You only need to worry about leaving DISABLED conditions that enable the specific location you want to isolate. Do not think in general, consider each one individually.

Comment
Add comment · Show 2 · 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 GKdev1980 · Apr 04, 2014 at 05:50 AM 0
Share

Could you be a bit more specific?

avatar image Kamuiyshirou · Apr 04, 2014 at 12:35 PM 0
Share

You know how to use a static class?

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

23 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 avatar image avatar image

Related Questions

Selecting an object on click, then clicking a UI button to change its color. 1 Answer

When pressing a button, it counts as pressing the screen and the button [New Input System] 0 Answers

multi toch GUI buttons 1 Answer

How to add touchscreen controls to this script? 0 Answers

Button key assignment? 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