Player is not moving using on-screen button in android but working fine in Game/Simulator mode

32 views Asked by At

I've a very simple scene with a player, a UI button & event system. I've attached an "On-screen button" component to the UI button which simulates Keyboard's UP key which I've used in script to move the player forward. When I click that button in Game mode or Simulator mode it moves the button forward.

Here are all the GameObjects for reference enter image description here

Observations till now

  • The UI button when clicked on the android device changes color to the buttonPressed color. That means, the button click is getting registered.

I've tried finding a solution to this greatly and now I'm getting frustrated with it. Please provide some solution or alternatives I can use. This also doesn't seem like a new solution to solve for. It's a basic function in any game and youtube tutorials only show the games working in Game Mode and not in actual mobile device.

What I have tried?

  • I have the Active Input Handling in Player settings set to "Both" and tried only New Input System as well.
  • I have tried creating a New InputActions.
  • I have tried creating a completely new unity project from scratch with just these basic things
  • I have tried to attach "on screen button" component to both UI Button as well as UI Image.
  • I have tried mapping the button to keyboard "W" key as well. Note: While in game mode my keyboards Up/W key are making the player move.
0

There are 0 answers