- Home /
Cross Platform Input Controller Not Working on Mobile Device
I have used Unity's Standard Assets - Cross Platform Input Control to create Dpad as per my game requirements.
I have following this video tutorial for implementation: How to move character or game object in Android Top Down Unity game with UI Buttons? Easy tutorial.
I have just imported Cross Platform Input data within the project, as like this only because of other things not useful to me.
Now to move the 2d player character, I have used this code:
horizontalMove = CrossPlatformInputManager.GetAxisRaw("Horizontal");
verticalMove = CrossPlatformInputManager.GetAxisRaw("Vertical");
4 Dpad buttons, I have a setup like this way:
After using the above code to get input for player movement, within Unity Editor, I can able to move my player but within the mobile device, I can't able to get any values. For horizontal and vertical both values, I was getting 0 as output.
Now give me some guidance to solve mobile input related solution based on Dpad buttons touch.
Answer by rahulpatil6220375 · Apr 10, 2019 at 01:03 PM
you can use CrossPlatformInputManager.GetAxis("Horizontal"); CrossPlatformInputManager.GetAxis("Vertical");
Answer by imranmollajoy · Oct 25, 2020 at 06:03 AM
Old question but maybe you have to switch to android build and if you so, if have to enable mobile control from the toolbar menu