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 02:43 PM · unity input

how does unity input works for pc and android

actually i want to know that how unity reads input for PC games like (MouseButtonDown) and android touches . I am not talking about methods to use them , i am asking how they work . Can anyone explain it please. Reason is a issue in my game which i am unable to explain to explain .

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
1
Best Answer

Answer by zereda-games · Feb 18, 2019 at 11:41 AM

its referenced under Edit->BuildSetting->Input

Each axis has a main input and an alternative pre done for you. to access them directly through code you access them via a string pasthrough. aka Input.GetKey("Vertical"){} or Input.GetKey("Horizontal"){} Works similar to how SceneManager handles build index with strings. if the list of scenes has a scene with the name called it returns that scene by name for example. similar method applies here. because Vertical and Horizontal Exist within the Axis' list we can call it by string in an Input.GetKey() GetKeyDown() or GetKeyUp();

Comment
Add comment · Show 3 · 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 musicalbulltz · Feb 19, 2019 at 02:59 PM 0
Share

thanks for your reply. I am building a game like zig-zag and added a UI button Jump . So my player(Ball) should only change direction when we tap on screen , and it's working fine on pc as well . But after running on my android device it's not working as when i tap on UI the player's direction is also changing so please help. I am really in great confusion.

avatar image zereda-games musicalbulltz · Feb 19, 2019 at 03:03 PM 0
Share

I saw a question on this exact issue the other day, i'll post when i find it. hang tight, and i'll try and be quick.

avatar image zereda-games musicalbulltz · Feb 19, 2019 at 03:16 PM 0
Share

Link 1 https://answers.unity.com/questions/1473551/android-touch-input-not-working-in-build.html

Link 2 https://answers.unity.com/questions/1063429/problem-moving-a-gameobject-with-an-ondrag-event-w.html

Extra notes:

[Added] Link 3 https://docs.unity3d.com/ScriptReference/Input.GetTouch.html

[Added] Link 4 https://answers.unity.com/questions/647281/how-to-use-android-input.html

[Added] Link 5 https://docs.unity3d.com/$$anonymous$$anual/PlatformDependentCompilation.html

sorry but none are the one i was on the other day, but these may help you, sorry if not. hope you have some luck.

avatar image
0

Answer by dan_wipf · Feb 18, 2019 at 11:48 AM

i can’t tell you exactly how it works, but there are several methods for several situations to keep in mind!


just fyi:

  • Input.something method => used at runtime no UI

  • event.current method => used for editor

  • ipointer method => used for UI elements


i believe there are more methods to add to this list those are just the common one i use in my projects

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

100 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

Related Questions

Problems with FPS controller movement 0 Answers

Input not working on web player build. 1 Answer

Input System: How To Prevent Mouse From Auto-Switching Control Scheme? 1 Answer

Not getting input from joysticks unless it's 360 controller. 1 Answer

Integration of Developed Unity App into another developed Native iOS app as part of application by adding subview or any other way? 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