Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
2
Question by · Aug 31, 2017 at 12:24 PM · mobiletouch controlsstandard assetscrossplatformtouchpad

CrossPlatformInputManager.GetAxis() always returns 0

Problem: Just as the title says. It's the same for both Horizontal and Vertical axes. Input.GetAxis() works just fine. Interestingly, when I click Mobile Input -> Disable then CrossPlatformInputManager.GetAxis() starts working with the WASD keys.

The specific control I'm using is the DualTouchControls prefab. I removed the turn/look controller but kept the MoveTouchPad.

What I've done to try and fix it:

  • Deleting everything referencing the CrossPlatform (including objects in scenes of course) and reimporting

  • Verified that there is an EventSystem in the scene

  • Checked to make sure the MobileControlRig is set to target the correct axes in the inspector

  • Set you Unity build settings to a mobile build (specifically Android)

  • I've also built the project and put it on my phone (Galaxy S6) with no luck

Most people with this problem that I have seen from Googling were missing EventSystems but I had always had one and I cannot for the life of me figure this out.

I have not modified any code in the CrossPlatformInputManager and the only code I have calling it is assigning the vertical and horizontal axes to variables:

         float turn = CrossPlatformInputManager.GetAxis("Horizontal");
         float acceleration = CrossPlatformInputManager.GetAxis("Vertical");



Comment
Add comment · Show 1
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 thunderbuns · Dec 08, 2018 at 09:33 PM 0
Share

Did you ever find an answer to this?

5 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Ken_y1 · May 04, 2018 at 02:06 AM

You can try to change the Response Speed on Axis Touch Button Script which you have attached to you UI buttons.

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 mansoor090 · Jan 09, 2019 at 09:06 AM 0
Share

ty bro it worked

avatar image
1

Answer by sorcerboo · Oct 25, 2020 at 01:40 AM

Add this text: Project settings > Player > Other settings: Scripting Define Symbols: "CROSS_PLATFORM_INPUT;MOBILE_INPUT"

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

Answer by LesleyWit · Jan 07, 2018 at 04:32 AM

Bump, i've got the same issues and am looking for an answer.

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

Answer by DevilZ1976 · Feb 08, 2019 at 08:23 AM

Hey ya'll,

I may have found a temporary solution. Try using virtual axis reference because it sets value to it

 horizontal = CrossPlatformInputManager.VirtualAxisReference("Horizontal").GetValue;

If it's still not working try using .GetValueRaw instead of GetValue and set higher response speed.

Hope it helps,

Stay healthy

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 aliiskla800 · Mar 18, 2019 at 03:10 PM 0
Share

thank u so much it really worked,,, what about the jump button I have the same issue?

avatar image
0

Answer by Wolverine-X-man · May 24, 2020 at 07:02 PM

 float horizontalThrow = CrossPlatformInputManager.GetAxis("Horizontal");

this is also working code in the situation in unity 2020.1 (Beta) version

go to Edit -> project setting -> Editor ->Joysticksource change to Local and run OR Restart Your Unity Engine & Visual studio 2019

i am facing the same issue, soo here is my solution...

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

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

Related Questions

Button and Touchpad work together 1 Answer

Change a float value with the horizontal axis? 1 Answer

How do you increase the turn speed on cross platform input dual touch controls "Turn and Look Touch Pad" 0 Answers

Touch input problem 1 Answer

Is there a way by which we could control/move Cinemachine FreeLook Camera using TouchField/TouchInput for mobile? 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