Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 musicalbulltz · Feb 17, 2019 at 07:14 AM · andriod

how to stop UI from affecting player direction on touching .

I am making an android game like zig - zag so when i build and run my game on android and tap a UI it's affecting the balls position ,which it should'nt. While on editing on pc if I run the game the UI is'nt affecting the position of ball(expected result ). Please Help.`
// Do ball rolling things if (Input.GetMouseButtonDown(0)) { if (EventSystem.current.IsPointerOverGameObject() == false) // works on pc only { if(Input.) rb.velocity = new Vector3(speed, 0, 0); started = true;

                         gameManager.instance.StartGame();
                         Destroy(GameObject.FindGameObjectWithTag("Ground"), 6f);
                     }
             Health.instance.gameStart = true;
                 }`


Comment
Add comment · Show 5
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 RobAnthem · Feb 17, 2019 at 07:56 AM 0
Share

Any touch at all is considered $$anonymous$$ouseButton(0), and two touches in $$anonymous$$ouseButton(1).

But I would highly recommend using a touchpad or joystick system and some crossplatform input ins$$anonymous$$d.

avatar image Eno-Khaon RobAnthem · Feb 17, 2019 at 09:48 AM 0
Share

Actually, touch acting as mouse input can be disabled using Input.simulate$$anonymous$$ouseWithTouches.

By separating mouse and touch inputs into their own schemes, I've never had issues with EventSystem.current.IsPointerOverGameObject() failing to give a proper result.

avatar image musicalbulltz Eno-Khaon · Feb 17, 2019 at 10:26 AM 0
Share

Thanks for your answer. EventSystem.current.IsPointerOverGameObject() is working fine But! On PC only and when i build and run it on my android device it's not working . As my player(Ball) should only change position when player touches the screen ,not the UI and it's fine in PC but not on my Phone.

Show more comments
avatar image musicalbulltz RobAnthem · Feb 17, 2019 at 10:33 AM 0
Share

Thanks a lot for your answer.I have already completed half of my project using "$$anonymous$$ouseButtonDown" so changing it might create some serious bug issues for me as i am still learning about c# and unity , so i am trying to stick to my code and solve the issues . So is there any way by which I can stop UI elements from feeding Input to my player $$anonymous$$ovements. @RobAnthem

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

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

Related Questions

Andriod game crashes on start up 2 Answers

Is there a way to estimate file size from www class downloaded from Dropbox 1 Answer

Dynamically scale my scene/game objects for any mobile device. 1 Answer

Location Service doesn't work on tablet build, does with Unity Remote 0 Answers

Automatic GUI Creation When players are Added. 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