Assigning Input Actions in the Inspector - Unity's New Input System

preview_player
Показать описание
Assign input actions in the unity inspector using input action reference as part of the new input system. Easily assign hotkeys in the unity inspector.

Support the Channel!
**********************

Video Gear List (Amazon Affiliate)
***********************************

Other Links
************

Timestamps
*************
0:00 Intro

#GameDevelopment #Unity3D #indiedeveloper
Рекомендации по теме
Комментарии
Автор

Heads Up: the way it is implemented in the video your code will listen to the reference in the map. Meaning it will listen to all devices firing that event.

If you need to dissociate devices as in local multiplayer or other needs you either handle devices separation or use the InputActionRefence's ID in orther to find its action in an Unity's PlayerInput component. Something like this:

// Assuming you already have the PlayerInput instance in your code...
InputAction myAction =

This will find the action wich you are refering to in the PlayerInput and as device pairing is already handled by Unity, you can now listen to "myAction" events instead of listening to the reference, therefore trusting there will always be devices distinction if needed.

Edit: I was caught up formulating how to express the code piece of the comment and left out the part where I believe this tip is gold. It makes handling inputs way more scalable because it allows to craft handlers for specific actions in a blink. Thanks for the video.

OIndieGabo
Автор

My google fu almost let me down, but you solved it. The simple piece of code you posted does not require the InputActionReference to be compiled to a c# class - it works just as well whatever way the input action communicates device input to your project.

TheArghnono
Автор

This tutorial was more helpful than any other, thank you so much !

lefoudegaming
Автор

Input rebinding seems to work. I'm using a modified version of InputSystem v1.6.1 Rebinding UI sample (which I've gotten it to work with UI Toolkit with some manual work). I haven't tested local multiplayer but @OIndieGabo seems to be on the right track about that.

InputActionReferences opens up a lot of my scripts for my singleplayer games where I need to call input functions of completely different GameObjects. Thanks for the vid!

holmbergen
Автор

Down the road, I will eventually start using the new Input System. But until Unity makes the old one obsolete, I'll keep using it.

leedavis