Gamepad Cursor with Input System - Unity Tutorial

Uploaded by samyam
Share: Twitter Facebook
Make a custom gamepad cursor using Unity's New Input System. This way you can navigate UI using a controller similar to a mouse.

? Get the Source Code ?
https://www.patreon.com/posts/57282387

? Support Me ?
Patreon: https://www.patreon.com/samyg
Donate: https://ko-fi.com/samyam

Thanks GeekZebra for helping make this video possible!
*Sorry for the desk noises, the mic is really sensitive and setting the controller up and down is not helping.

►? Relevant Video Links ?
ᐅ Virtual Mouse Input System Documentation
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.1/api/UnityEngine.InputSystem.UI.VirtualMouseInput.html
ᐅ Kenney - Crosshair Pack
https://www.kenney.nl/assets/crosshair-pack

In this video I show you how to make a gamepad virtual mouse cursor that can navigate around the scene and interact with the UI. This works with the new input system, any canvas scale and canvas type, the PlayerInput component, and you can adapt it further to fit your needs easily.

We use a gamepad or controller and pipe the input to a Virtual Mouse in the Input System. In our Input Action Asset UI map (created from the PlayerInput component), we add actions for the position and click of the Virtual Mouse. That input action asset is used in the Event System to replace the system mouse values.

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help me fund my development projects while recommending great assets!

? Other Cool Unity Assets ?
ᐅPeek - Editor Toolkit: https://assetstore.unity.com/packages/tools/utilities/peek-editor-toolkit-149410
ᐅEditor Console Pro: https://assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889
ᐅRainbow Folders 2: https://assetstore.unity.com/packages/tools/utilities/rainbow-folders-2-143526

►⏱️ Timestamps ⏱️
0:00 Intro
0:38 Install Input System
1:07 Gamepad Cursor Samples
1:57 Set up Scene
2:44 Create Cursor UI Image
4:27 Gamepad Cursor Script
19:51 PlayerInput and Input Action Asset
22:46 Debugging & Fixes
24:38 Preview working
25:40 Add Cursor Padding
26:40 OnControlsChanged Switching Between Mouse & Gamepad
33:28 Quick Null Reference Errors Fix
33:55 ScrollView Preview
34:18 Outro

??THANK YOU TO ALL MY PATRONS ??

❯❯❯ My Links ❮❮❮
? Patreon ?
https://www.patreon.com/samyg
? Discord Server ?
https://discord.gg/SwCKB3Q
? Twitter ?
https://twitter.com/samyam_utube
? Facebook ?
https://www.facebook.com/samyam.youtube/
? Music ?
Ambient Gold
streambeats.com
? Like and Subscribe! ?

?️ Computer Setup ?️
*As an Amazon Associate I earn from qualifying purchases.
https://www.amazon.com/shop/samyam

#madewithunity #gamedev #unity