How to use OnScreen-Controls on pc and android?

Hello,

currently I am struggling with the new input system when following the OnScreen Controls example from the new input system - specially with the analog stick, since it’s bound to gamepad devices.

So when I try to use these controls on pc with the mouse or on android with touch - it has no effect since it doesnt recognize a connected gamepad.

Is there a howto/tutorial how to get that to work on pc and android?

Since it’s a singeplayer game - the desired behavior would be that all controls are active at the same time: player can use onscreen controls and keyboard/mouse at the same time.

push - is the new input system not supporting mobiles? I noticed all questions about the new input system & mobile are ignored by the unity stuff.

I don’t really understand your posts, are you saying the OnScreen Controls example doesn’t work for you when you import it in an empty project?

Okay I try to explain it better.

  1. Created a new project with a simple platform and a cube to control via an onscreen analog stick.
  2. Added new inputsystem + onscreen controls
  3. updates eventsystem to new input system
  4. add playerinput to cube & create standard input asset
  5. create playerscript with OnMove method
  6. Place Stick.prefab from OnScreenControl sample in scene

Now I can move my cube with awsd/arrows - but no matter what I’ll try - it’s not possible to move the cube via the stick. Neither on Android nor in Unity Editor.

I also uploaded a demo project to github:
https://github.com/dawuwu/unity-newinput

I’m having the same issue! I can’t click to move the onscreen stick in the game window either.
The gamepad works fine when I attach it, but I’m trying to simulate mobile.

I’ve opened the sample called “OnScreenControlsSample”
I’ve noticed that if I use the Standalone Input Module (old input system), then the on-screen joystick works.
If I switch it to the Input System UI Input Module, then the on-screen joystick does NOT work…

Please see the image below; just flicking between those 2 modules in the inspector is enough to break it.

I can’t use the old input module in my project.

I have a video on mobile joystick control w/ new input system if that helps

@samyam
Thanks! It was actually your tutorial that I was following!
I posted another thread - as I thought this one was dead!:

https://forum.unity.com/conversations/new-input-system-package-on-screen-joystick-refuses-to-move.567913/

I included a package there that demonstrates it!

Awesome thanks!

Sam, first, your video is great. Second, any idea why on-screen controls don’t work if you use the PlayerInput component instead of the generated C# class?

Would you mind checking out this post and letting me know what you think?

Thanks! Just responded, here’s a copy:
I’m able to use a PlayerInput component and an On-Screen joystick when the PlayerInput action asset is different than the one the EventSystem uses, but the sample doesn’t seem to work for me when using the same asset.
Unity v2020.2.7f1 & Input System v1.1.0-preview.3

I clicked on the script and notice that was conditional flags to allow the code to compile.
PACKAGE_DOCS_GENERATION || UNITY_INPUT_SYSTEM_ENABLE_UI.
Someone can explain to me why the script appears gray in VS?