samyam | Gamepad Cursor with Input System - Unity Tutorial @samyam | Uploaded October 2021 | Updated October 2024, 3 hours ago.
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 full Source Code Bundle to my Unity Tutorials ๐ค
sam-yam.itch.io/samyam-full-source-code-to-all-videos
๐ฅ Get the Source Code ๐ฅ
patreon.com/posts/57282387
๐ค Support Me ๐ค
Patreon: patreon.com/samyg
Donate: 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
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: assetstore.unity.com/packages/tools/utilities/peek-editor-toolkit-149410
แ Editor Console Pro: assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889
แ Rainbow Folders 2: 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 ๐
patreon.com/samyg
๐ฌ Discord Server ๐ฌ
discord.gg/SwCKB3Q
๐ฆ Twitter ๐ฆ
twitter.com/samyam_utube
๐ Facebook ๐
facebook.com/samyam.youtube
๐ต Music ๐ต
Ambient Gold
streambeats.com
๐ Like and Subscribe! ๐
๐ฅ๏ธ Computer Setup ๐ฅ๏ธ
*As an Amazon Associate I earn from qualifying purchases.
amazon.com/shop/samyam
#madewithunity #gamedev #unity
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 full Source Code Bundle to my Unity Tutorials ๐ค
sam-yam.itch.io/samyam-full-source-code-to-all-videos
๐ฅ Get the Source Code ๐ฅ
patreon.com/posts/57282387
๐ค Support Me ๐ค
Patreon: patreon.com/samyg
Donate: 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
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: assetstore.unity.com/packages/tools/utilities/peek-editor-toolkit-149410
แ Editor Console Pro: assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889
แ Rainbow Folders 2: 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 ๐
patreon.com/samyg
๐ฌ Discord Server ๐ฌ
discord.gg/SwCKB3Q
๐ฆ Twitter ๐ฆ
twitter.com/samyam_utube
๐ Facebook ๐
facebook.com/samyam.youtube
๐ต Music ๐ต
Ambient Gold
streambeats.com
๐ Like and Subscribe! ๐
๐ฅ๏ธ Computer Setup ๐ฅ๏ธ
*As an Amazon Associate I earn from qualifying purchases.
amazon.com/shop/samyam
#madewithunity #gamedev #unity