#šŸ–±ļøā”ƒinput-system

1 messages Ā· Page 34 of 1

tepid thistle
#
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

public class PaddleInput : MonoBehaviour
{

    private PlayerInput playerInput;

    [Header("Controls")]
    [SerializeField] private string movementActionName;
    [SerializeField] private string usePowerActionName;

    // Variables
    public Vector2 input { get; private set; } = Vector2.zero;
    public event Action powerKeyPressed;

    private void Awake()
    {
        playerInput = GetComponent<PlayerInput>();
    }

    void Update()
    {
        input = playerInput.actions[movementActionName].ReadValue<Vector2>();
        playerInput.onActionTriggered += OnActionTriggered;
    }

    private void OnDestroy()
    {
        playerInput.onActionTriggered -= OnActionTriggered;
    }

    public void OnActionTriggered(InputAction.CallbackContext callbackContext)
    {
        if (callbackContext.action.name == usePowerActionName)
        {
            if (callbackContext.performed)
            {
                powerKeyPressed.Invoke();
            }
        }
    }
}```
austere grotto
#

that being said I don't immediately see a functional problem here. Can you add some logging? like:

input = playerInput.actions[movementActionName].ReadValue<Vector2>();
Debug.Log("$Read input from {movementActionName} - the value is {input}");```
tepid thistle
#

This is clearly better

austere grotto
tepid thistle
#

But the up and down arrows, it reads them normally

tepid thistle
#

Even worse, when I build the project for android, the opposite happens, the buttons that simulate W and S work, and the buttons that simulate the arrow keys don't

#

🄲

austere grotto
tepid thistle
#

Yeah

austere grotto
#

that's your problem

tepid thistle
#

Oh, really?

austere grotto
#

each PlayerInput grabs exclusive ownership over a set of input devices

#

in this case the virtual keyboard probably

#

so one of them will work, one won't

tepid thistle
#

Oh, I see. but then why does it work fine when I use the physical keyboard?

tepid thistle
#

Well, I created a single instance of the player input in the game manager and a getter for it to access from the player scripts

#

And now it works perfectly, thank you!

long tulip
#

I am working on creating a XR controller that activates when a headset is connected and when not connected, a regular windows controller is active. The XR controller does activate and the regular player deactivates but the XR player does not work, while I can look around I can’t do anything else, gravity does not effect me and I can’t walk around. I have attached the components on my XR player, if there is any other information that would be helpful please let me know!

fluid glacier
#

@livid valve @forest echo
I came here to Discord looking for a solution and saw that you guys had the same problem as me. The game works normally in Unity Editor and on PC, but on Android it doesn't recognize any clicks when we use the New Input System. I haven't found a solution yet, but I realized that it's something to do with the migration from the Old Input Manager to the New Input System.
My project uses the Old Input Manager, and I'm trying to migrate to the new one, which caused the problem.

I created a new project from scratch, containing only one Input field and one button, using the New Input System, and it worked on a real Android device.
Now I just need to find a solution for this...

fierce compass
fluid glacier
fluid glacier
fluid glacier
#

Found the solution, sharing because it can help someone else.
My scene is a remote addressable and I forgot about it, so I had to replace StandaloneInputModule by InputSystemUIInputeModule and update my remote addressable.

quaint sinew
#

hello
i know this isnt technically the input system but i am having some weird issue where OnPointerClick doesnt do anything, it should be firing but it doesnt, OnMouseDown works, but not OnPointerClick, why ?
i made an empyty scene with only a cube with the script in it (see image, the fact that its visual scripting shouldnt matter), a camera with a physics raycaster on it, an object with an evensystem on it, but it still doesnt work for some reason, i did check that everything is on the same layers and stuff but i am stumped, it used to work and it randomly stopped firing today
i couldnt find answers online

quaint sinew
#

mystery solved, i removed some stuff in the input system and i didnt know that onpointerclick relied on that, i thought it was just default unity inputs that you can change around and stuff, thankfully theres a button to bring back the defaults on the even system component, yippie

limber swan
#

anyone know how to fix this? I have Unity 6000.3.2f1

austere grotto
limber swan
austere grotto
limber swan
#

Thank you, i cleared cache from AppData/Local/Unity/Caches and it worked

#

nvm, after restart again now all my packages are invalid

amber wigeon
#

just ignore it until the issue is fixed, it's on Unity's side.

tepid thistle
#

Is there any way to put the center of the on-screen stick on the center? I tried changing the pivot of the arrow but it doesn't work.

austere grotto
austere grotto
#

kinda weird for an onscreen stick

#

i'm not sure what the circle in the top left is tbh

#

the one in the center seems to be the pivot

tepid thistle
#

The circle in the top left is the area on which the stick moves

#

Idk why it isn't on the center

austere grotto
#

Can you show the RectTransform settings for it

tepid thistle
austere grotto
#

wait nvm

#

hmmm, this is confusing. Why is your stick a tall rectangle? What's the idea with that

#

ahh the animation works if you click the link, not sure why it's not playing in the embed

tepid thistle
austere grotto
#

I see

#

Yeah sorry I'm not really sure what's goin on

tepid thistle
#

Oof, I see

#

Well, I need to try and find an alternative then

supple crow
austere grotto
#

To be honest I think what they basically want is a slider that will count as an input axis.

#

but without a visible handle

#

And only provides input when touched

patent garden
#

should i use OnClick for buttons to switch gamestates or is that bad practice?

fierce compass
#

it's not bad practice, and whether it's a good idea or not depends wholly on your game's setup and flow

tall eagle
#

Hi All, Having an issues with my mouse controls for looking... When running my game the input from my mouse does not seem to be working, Its only after i go into Input Debugger and Enable the Mouse that it works... Although the keyboard inputs work without doing this. Is there a way to permanently enable this? Thanks.

fierce compass
#

how are you receiving input? are the bindings perhaps set to different control schemes

tall eagle
#

I created a single Keyboard and mouse scheme, and make it the default on the "player"

austere grotto
tall eagle
fierce compass
#

you said you had a single keyboard and mouse scheme?

tall eagle
#

I think so šŸ˜„

fierce compass
#

ah wait no hold on

#

i think ive confused myself

#

yeah ok i misremebered the brackets being the control scheme, whoops

summer marten
#

Hi, we are having an issue in our game where controller inputs are doubled when Steam Input is enabled.
Basically the original controller signal AND the Steam Input signal both reach the game, causing in a frequent back and forth between both Controllers.

Player1 Device switched! Axis:/XInputControllerWindows/leftStick/x
Player1 Device switched! Axis:/XInputControllerWindows1/leftStick/x
Player1 Device switched! Axis:/XInputControllerWindows/leftStick/x
Player1 Device switched! Axis:/XInputControllerWindows1/leftStick/x
Player1 Device switched! Axis:/XInputControllerWindows/leftStick/x
Player1 Device switched! Axis:/XInputControllerWindows1/leftStick/x```
As you can see it switches between XInputControllerWindows and XInputControllerWindows1. One of them is Steam Input and one is the actual Xbox controller.
Is there any way i can ignore the "normal" Controller when Steam Input is enabled?
It might be a setup issue on my side, but I can't find anything in the InputSystem codebase to show me how this should be handled in theory. Is SteamInput supposed to supress the original inputs from reaching the game? Is there any kind of "deactivated" state of a input device i'm not considering?

Edit: also created a Unity Forum topic https://discussions.unity.com/t/steam-input-duplicated-input/1706043
wheat dagger
#

Hey, I'm trying to use Accelerometer as an input, when in Editor using Unity Remote I am able to use it just fine, but when I build and try it on Android the value returns a Vector3 zero

I've tried both "Input.acceleration" in code and also using Input Actions and neither seem to work on the actual build, only in Editor using Unity Remote

supple crow
#

perhaps you need to ask for permission to use accelerometer input?

#

that's a shot in the dark

supple crow
summer marten
# supple crow How are you using Steam Input? I am interested in supporting that, but I've neve...

I'm not using it personally, we've just gotten multiple reports of people having issues with it. On some machines it's just activated by default, even though we support all controller types. I was able to reproduce the double input issue by activating Steam Input while the game is currently running, but there are a lot of people who encounter by just having it enabled and starting the game.

#

I think as soon as you start the game using the Steam Overlay, Steam Input can be enabled in the Steam Overlay Settings

supple crow
#

interesting – does this happen on a Steam Deck? I have one for testing on Linux

summer marten
#

I only know about it happening on windows, might happen on Steamdeck too, not sure.

cold steppe
#

Hey all! What's considered best practice for implementing controller rumble in unity? I hear Gamepad.SetMotorSpeeds() is very very heavy (2 to 4 ms???) so I'm guessing that's not it

#

I'm seeing surprisingly little info and tutorials for this side of controller implementation online

#

(similarly enough when last week i was looking for gyro implementation i litteraly found nothing - if someone has leads on that it could be cool too)

verbal remnant
cold steppe
frank stream
#

Im using Player Input ->Events and have a OnInteraction - Action of Button Interaction type. Is there anyway to only trigger it once so you cant hold it? I

#

I read about InputActionReferences which kind a do what i want. But i was wondering if there is another way.

verbal remnant
# cold steppe when you mention, "through input system" do you mean by using Gamepad.SetMotorSp...

AFAIK it doesn’t work for the PS5 dual sense. But it should work for the PS4 DualShock. To use haptics on the PS5 controller you need the PS5 SDK and build for that platform. Whether you can work around that by custom implemented input device in Unity and some windows driver, I don’t know. If the device isn’t supported by the OS driver, you need to build or buy the missing pieces yourself.

#

You also need to respect the hardware latency & inertia of the device. If the controller has a motor, not a piezo, a short enough signal may not translate into any motion.

#

Generally if you want to work with gamepads, it’s best to target the specific device, not the gamepad abstraction

cold steppe
gleaming canopy
#

I'm having a big headache regarding keys being held when a scene changes.
I don't even know if it's related to my code, but currently my code is this
⁨⁨```cs
bool sprinting => ClientInput.Primary.Sprint.IsPressed();

When the scene changes, if the key is down, the input acts reversed. Pressed is up, and up is pressed. I've tried a lot of things but nothing has really helped.
austere grotto
gleaming canopy
#

The commented lines are things I've tried to fix it

tame oracle
#

Hey guys i've made a custom virtual mouse however it doesnt allow any interaction with ui. here is the following code:
https://paste.ofcode.org/qLe4GezhrrXTpu8WAtp2Dh

I've properly set up the event system and ui input module yet it doesnt detect ui.

austere grotto
austere grotto
#

Is there a good reason you're using control schemes?

#

Are you doing local multiplayer?

tame oracle
tame oracle
glass tangle
#

Hi

#

There is a way the use the Gamecube controllers with the new input system?

fierce compass
#

yes, inputsystem can use arbitrary input devices provided you give it configuration on how to treat it

#

there might be a package that provides that config to input system, perhaps try searching around in eg upm

glass tangle
#

Well I have GameCube controller adapter

#

But it only detectives whether the adapter is the mode "PC", not the mode "Wii U/Switch"

#

The mode "Wii U/Switch" have the controller of Zadig

craggy silo
#

Hey
the app on startup doesn't register gamepad input until I move my mouse or press a keyboard key. The lack of focus for the app is a huge problem on SteamDeck.

private void Start()
    {
        if (InputUtilities.lastUsedDevice is Gamepad)
        {
            Cursor.visible = false;
            this.PlayButton.Focus();
        }
    }

this code runs and registers the gamepad properly, but the gamepad input is not being recognized. I'm looking for a way to focus the OS on the game with just the gamepad.

I'm using InputSystem and UIToolkit, Unity 6.3, and starting my game with a gamepad.
Please help!

distant sphinx
# craggy silo Hey the app on startup doesn't register gamepad input until I move my mouse or p...

Look into how Devices are binded into users, maybe. From my own experience in my project once there's something a device binded you'll have to manually bind a second one if you want it binded on the same user
This meaning, Unity creates a InputUser with keyboard, it will not bind a gamepad to it, and it will instead create a new InputUser

Though it has been a while since I've done a deep dive like that

#

I'm having an issue of my own, I currently have some code meant to do something:

        [SerializeField] InputActionReference? toggleAction;

            if (toggleAction != null)
            {
                toggleAction.action.performed += OnTogglePerformed;
                toggleAction.action.Enable();
            }

The action is performed just fine when I have no InputUsers, but the moment I perform a pairing (and thus create a InputUser) it stops working:

                newUser = InputUser.PerformPairingWithDevice(pairWithDevice ?? InputUser.GetUnpairedInputDevices().FirstOrDefault());

            //Associate the Game Input Actions
            var a = new GameInputActions();
            a.Enable(); //TEMP: Enable here?
            a.System.Enable(); //Enable the System Action map. This should be enabled at all times.
            a.Debug.Enable(); //Also enable the Debug action map.
            newUser.AssociateActionsWithUser(a);

Is this because I am creating a new action here and is not holding the same reference to the one that my monobehaviour has?

distant sphinx
#

When I copied some of Unity's systems over a year ago or so I had this:

        public LocalUserJoiner()
        {
            // if the join action is a reference, clone it so we don't run into problems with the action being disabled by
            // PlayerInput when devices are assigned to individual players
            if (_joinAction == default || (_joinAction.reference != null && _joinAction.action?.actionMap?.asset != null))
            {
                _joinAction = new InputActionProperty(_inputActions.System.UserJoin);
            }
        }

Then some notes around:

1. Global binding re-resolution: When the user's GameInputActions is enabled, it sets s_NeedToResolveBindings = true globally (InputActionMap.cs:327). This triggers DeferredResolutionOfBindings() which iterates over ALL action states and re-resolves bindings.                                                                                    
  2. Full re-resolve disables/re-enables actions: During a full resolve (InputActionState.cs:421-425), actions are temporarily disabled and then re-enabled. If something goes wrong during this process, actions may not be properly restored.   ```
#

So that's why I suspect there's something acting with creating and assigning something through code to trying to use an action because its a gameobject UI element holding a reference

#

I also suspect there might be something to do with group filtering (Control scheme)

#

The action itself has a Keyboard&Mouse group filtering, but the way I perform pairing with a Mouse is janky as hell:

        Entity JoinPlayer(short playerIndex = 0, string controlScheme = "", InputDevice? pairWithDevice = null)
        {
            if (!CheckIfPlayerCanJoin(playerIndex))
            {
                Debug.LogError($"Failed to join player: Invalid index {playerIndex} or max players reached");
                return default;
            }

            //This should create a new user.
            InputUser newUser = default;
            try
            {
                newUser = InputUser.PerformPairingWithDevice(pairWithDevice ?? InputUser.GetUnpairedInputDevices().FirstOrDefault());
                if (!newUser.valid)
                {
                    Debug.LogError("Failed to create valid InputUser");
                    return default;
                }
            }
            catch (Exception ex)
            {
                Debug.LogError($"Failed to pair device: {ex.Message}");
                return default;
            }

            if (pairWithDevice is Keyboard)
            {
                var mouse = Mouse.current;
                if (mouse != null)
                {
                    InputUser.PerformPairingWithDevice(mouse, newUser);
                     ....
                }
                else
                {
                  .....
                }
            }

            //Associate the Game Input Actions
            var a = new GameInputActions();
            a.Enable(); //TEMP: Enable here?
            a.System.Enable(); //Enable the System Action map. This should be enabled at all times.
            a.Debug.Enable(); //Also enable the Debug action map.
            newUser.AssociateActionsWithUser(a);
(...)

So that might not be working because the Action is looking for keyboard and mouse and Im not doing that correctly

distant sphinx
#

I believe its that monobehaviour UI thing that the manual tells you to use

crimson frost
#

I've switched over to the new input on a new project, but even after setting up everything I'm still getting this warning in the console

fierce compass
#

seems like you're using the old input system somewhere still

#

or it may be a dependency/package

crimson frost
#

The only non-Unity package I added was UniTask, which shouldn't touch input at all.

#

I've also not set up any scripts to read input yet, either old or new

austere grotto
#

even if nothing is actually using it

#

Check your Active Input Handling setting in player settings -> other

crimson frost
#

You know what? It was the old event system object buried in my hierarchy, it had the old module in it and not the new one
Would be nice if the warning flagged what component was triggering it, as this has been bugging me for a while

austere grotto
#

ah yeah that'll do it too

#

but that will also give a real error at runtime

crimson frost
#

Nope, wasn't getting an error at all from it when I hit play.

austere grotto
#

odd

crimson frost
#

well, not an error, just warnings

#

Nope, still getting the warning after deleting the old module component and the extra event system

crimson frost
frigid ridge
timber garden
#

I need help with implementing gyroscope/phone-tilting controls with the new input system. I managed to have simple controls with WASD/Arrow Keys, and now need to do the same with gyroscope. What's the best way to set it up in the Input Action Manager? How do I retrieve the values?

austere grotto
#

then read the data as you would from any other input action

timber garden
# austere grotto then read the data as you would from any other input action

Stupid question: how do I read the data?
Previously, when I took values from my keyboard, I wrote this:
Vector2 input = playerInputMap.FindAction("Move").ReadValue<Vector2>();
Now I'm realizing that just replacing the action name and vector type isn't really going to work here. Do I need to check and/or enable the device with the gyroscope before I read the values? What am I missing?

fierce compass
#

Now I'm realizing that just replacing the action name and vector type isn't really going to work here.
why wouldn't it?

austere grotto
fierce compass
#

(though, imo you shouldn't be using magic strings to begin with)

austere grotto
#

unless you mean that your code does not know how to handle a Vector2 for this rotation

timber garden
fierce compass
#

as in, you're getting a zero vector?

austere grotto
#

did you enable the input action?

timber garden
#

I'm tiling the phone during the game scene - and all X, Y, and Z values return 0

austere grotto
#

are you making a build, or are you using Unity Remote

timber garden
#

Doesn't every phone after 2020 have a gyroscope?

fierce compass
#

try checking the input debugger to see if the gyroscope is being picked up

austere grotto
timber garden
austere grotto
fierce compass
#

not sure if the input debugger would work through unity remote, never looked into that before

timber garden
#

I tried to tick my phone in Input Debbuger -> Remote Devices, and I just got this error:
Failed to connect. Check if there is an app running on the correct device and it was built with Developer Mode enabled. In case of further issues you can enable the player connection diagnostic switch to get more information.

#

The way I see it, is that it doesn't want to fully connect to the project, even though it recognizes the device?

#

(I think I'll be taking a break now)

austere grotto
late hearth
#

Is anyone else having the issue where their thumbsticks feel 'springy'? I was testing a movement system using root motion and I feed the magnitude of the thumbstick input directly to the animator. What I have noticed is that if I quickly snap my thumbstick from 0 to about 0.5 or so, it will actually reach 1 and then come back down, like the input has some kind of predictive momentum to it.

  • Am I the only one who has experienced this?
  • Is there a way to turn it off?
#

My code for reference, but I am not doing anything special here.

#

Even using the input directly and ignoring the rotated vector it still behaves this way. I have found this problem difficult to search because its hard to articulate it, but I have found no settings that seem to relate to it. I am just using the default Input System settings from a brand new project.

#

There's no input processors or anything on any layer of the Move action.

#

Sigh. After looking at my controller configuration in windows, this seems to be a hardware problem. So bizarre. I don't think I've ever seen it before today.

#

The only way I can imagine around this is by using a convolution filter of some kind, which will introduce some latency. That sucks.

dapper minnow
#

So I’m trying to get into making VR games and I’m currently following a YouTuber by the name of valem tutorials and for the controller tracking I needed to put in an input action reference that is titled XRI left/position, but when I go to the page it doesn’t show up anyone have any suggestions?

dapper minnow
late hearth
#

This is where mine was located

dapper minnow
#

OK, let me try that and I’ll get back to you

dapper minnow
#

So another issue that was preventing me from going forward was that when I was trying to get the XR origin it only gave me this option so I don’t know if it’s like a new thing. Do you think I should just do that?

austere grotto
late hearth
dapper minnow
austere grotto
#

Your screenshot looked like you did the plus button which isn't what that tutorial did

dapper minnow
#

Ok ok believe I fixed it. I just had to downgrade to the version he was using. I just didn’t do that earlier because he said that this part shouldn’t change

buoyant bluff
#

Hello,

I created a visual interface in my game, and the new input system has started malfunctioning badly... I don't know how to fix it.

If you know how it works in detail, I would be very grateful to hear your explanation because it's a complete mess to me...

(PS: I don't know how to explain it, I'd like to call to demonstrate because I can't find the words to describe it)

buoyant bluff
#

I've fix this šŸ˜…

elder pine
#

Hello, I have a quick question. I'm using Unity New Input System in my Project and I'm using Linux OS.
I have a problem, I'm trying to display current key binding on action so player can rebind it. Im using GetBindingDisplayString() and it returns correct key name + some gibrish that I have no idea where it come out from

#

And that part after W appears in all of the keybids

#

Only mouse buttons are correct

buoyant bluff
#

https://www.youtube.com/watch?v=OMVMqFZV03M

may be use that for to help u ?

Getting started with the New Input System: https://youtu.be/ONlMEZs9Rgw

Join our Discord: https://discord.gg/WSus22f8aM

Get me to coach your game & gamedev career: https://calendly.com/bitemegames/gamedev-coaching

Thank you to our Patrons:
Stephane Gregorysatha
Sander Zwaenepoel
evykdraws
Anthony Lesink
Jon Bonazza
Gabrielle Edwards
AdriƔn...

ā–¶ Play video
buoyant bluff
elder pine
buoyant bluff
#

see how to that function

elder pine
#

XDDD

buoyant bluff
#

i've never used that, but I think it's importent to see

elder pine
#

Im 99% sure its a OS problem

buoyant bluff
elder pine
#

But I have no idea how to solve it

buoyant bluff
#

do u use a rebind action UI script ?

glass yacht
#

When you log the value is it actually outputting like that or is it only in your UI

glass yacht
#

It's logging even if you just get the string from the input system without modifying it in any way?

elder pine
glass yacht
#

Bizarre

elder pine
#

Ow and on Windows in works fine, my friend checked that

#

It's just Linux case

glass yacht
elder pine
glass yacht
#

The 3 characters that are being appended

buoyant bluff
elder pine
#

Only in this case it dosen't show SPACE

buoyant bluff
glass yacht
#

I just want to search for them but I don't know how to make the first character to search it

buoyant bluff
#

have u try with the exampl of input system package ?

elder pine
#

I guess no

buoyant bluff
elder pine
#

YOU ARE RIGHT

#

But how the hell to fix it

buoyant bluff
#

all right

buoyant bluff
elder pine
#

Maybe if I change the Keyboard layout to English???

buoyant bluff
#

what's ur keyboard ? (AZERTY ? QWERTY...)

buoyant bluff
elder pine
buoyant bluff
#

for exampl it's my keyboard layout

elder pine
buoyant bluff
elder pine
#

We are kinda closer

#

Now I have space

#

XD

buoyant bluff
elder pine
buoyant bluff
#

u are in linux or OS ?

elder pine
#

Kurwa... pls kill me

elder pine
elder pine
#

Okay but RebindUI still uses GetBindingDisplay to show string

elder pine
buoyant bluff
#

so delet the text after ur string about the key ?

elder pine
#

It dosent solve problem

#

Also how do you know how much text to cut?

buoyant bluff
#

yes try it

elder pine
#

Okay I wrote parser based on effective path

#

If anyone ever needs Im sending code

#

private string GetBindingName()
{
StringBuilder sb = new("");

        string keyPath = inputActions.asset[targetAction.name].bindings[index].effectivePath;
        string keyName = keyPath.Split('/').Last();

        // Handle mouse buttons separately
        if (keyPath.Contains("Mouse"))
        {
            return keyName switch
            {
                "leftButton" => "LMB",
                "rightButton" => "RMB",
                "middleButton" => "MMB",
                _ => throw new System.Exception($"Unknown mouse button: {keyName}")
            };
        }

        // Add space before uppercase letters (except the first one)
        for (int i = 0; i < keyName.Length; i++)
        {
            if (i > 0 && char.IsUpper(keyName[i]))
                sb.Append(" " + keyName[i]);
            else
                sb.Append(keyName[i]);
        }

        return sb.ToString().ToUpper();
    }
#

I'm on 100% sure there exists edge case that it may fault

#

But better this then fighting with OS

elder pine
#

Ow

#

My

#

God

#

I love you man

#

It works

fierce compass
elder pine
#

This dosent work

#

This works

fierce compass
#

doesn't the former use the latter

#

fwiw i'm using the former in my own project

elder pine
fierce compass
#

mac, so closer to linux

#

what issues were you having with the former?

bold pivot
#

Technically true. Mac's are unix based.

elder pine
fierce compass
#

you tell us

#

what was the issue

elder pine
# elder pine

This was the output when I used GetBindingDisplayString

fierce compass
fierce compass
#

it seems like there are some stray invisible/corrupted characters there after the displayname, if you could log out their charcodes that could help debug the issue

#

(though if using ToDisplayString directly doesn't have an issue you could absolutely just go with that and not worry about it)

elder pine
#

I have other tasks to do

#

But thanks for that method

#

You are a life saviour

bold pivot
#

Figuring out how to write a unit test for testing input took a while. Either google's AI was giving me a hallucinated result or I mistakenly thought for some reason yesterday that it was telling me to have "using UnityEngine.InputSystem.TestFramework" to use the Press() method....turned out I should have been inheriting from InputTestFixture...

#

It also took me a while to figure out how to get a ButtonControl directly from an Input Action, so I don't have to know what button's are bound to the action. You do something like this: YourActionButton = [YourAction].controls.ToArray()[0] as ButtonControl and pass that into Press();

#

The examples typically test by calling Press(keyboard.spaceKey) or Press(gamepad.buttonSouth). But I think that makes a unit test pretty fragile. it'd fail when testing if the action was triggered just because you changed the binding to something else.

#

Now that I have figured that out I can finally actually get back to figuring out how to refactor the Unity Tank Tutorial's code to use the new input system....

dreamy kernel
#

Are there any best practices or typical solutions for handling multiple joysticks for the same player? Say I want to support a HOSAS (Hand-on-Stick-and-Stick) in the new input system. Each sticks is their own USB device, and such their own joystick device.

austere grotto
#

just by setting both joysticks as required devices in the scheme.

#

Although IDK how those particular devices are considered/identified in the input system

verbal remnant
# dreamy kernel Are there any best practices or typical solutions for handling multiple joystick...

input system has only a very generic idea of what a joystick is. you often have to make a semi custom action map for the specific model you have, if you want to support multiple different models, you regularly need to make a custom driver for exactly those and map to a custom generic abstraction. but you can have mutliple ones by using the PlayerInput component and addressing them individually as a split-screen multiplayer input. Or you can ofc DIY that, player input can give you orientation. Generally there are no strong best practices for that kind of thing.

dreamy kernel
#

Hmm... I don't know which combination of joysticks the players will have. I plan to have Keyboard, Mouse and Gamepad as normal controllers, then controllers more generic with custom bindings so players with crazy joystick setups can configure it themselves. There is only 1 player on the same computer.

#

For example, I know someone who has a flight setup with 8 controllers and who could then configure 2-3 controllers for use in my game.

verbal remnant
#

generally, if you want to support joysticks (more than axis + 2 buttons), that joystick support is a whole project onto itself

#

rewired (asset built on top of input system) can help with that joystick support

dreamy kernel
#

Can't use rewired sadly. OpenXR requires the new input system. Using both causes mouse clicks to no longer be reliably registered in rewired

austere grotto
#

for a game like this, your players would demand such a system anyway I believe

verbal remnant
#

at the end of the day joystick support is nothing magical, it mostly boils down to button and axis mapping, which all report as weird names which you have to know so you can map them properly to your action maps without the user having to do it all manual.

austere grotto
#

I think the main issue you're going to run into is a binding disambiguation problem. If Unity's input system sees all of these devices as just "joystick" then binding something to "Joystick/Button1" for example will be ambiguous between all Joystick devices

dreamy kernel
#

Yes, I trying to tackle the binding disambiguation problem atm. My current thought is to use the joystick.deviceId to add new bindings and then prioritize them.

#

Thank you for your answers. Was help

austere grotto
#

Basically... I'm wondering if the Actions abstraction provided by the input system makes this impossible and you might have to make your code actually manually read input from different devices

#

which would kind of suck

#

e.g.

void Start() {
        // Assume devices were paired in the order: Left, then Right
        // The 'user' property holds the list of all hardware assigned to this player
        var devices = _playerInput.user.pairedDevices;
        
        if (devices.Count >= 2) {
            _leftDevice = devices[0];
            _rightDevice = devices[1];
        }
    }

    void Update() {
        if (_leftDevice is Joystick leftJoy) {
            Vector2 leftInput = leftJoy.stick.ReadValue();
            // Apply Left Track movement...
        }

        if (_rightDevice is Joystick rightJoy) {
            Vector2 rightInput = rightJoy.stick.ReadValue();
            // Apply Right Track movement...
        }
    }```
dreamy kernel
#

Looks like I can use inputAction.PerformInteractiveRebinding with only completing the action when the right device is selected.

.OnPotentialMatch(operation =>
{
    if (operation.selectedControl.device == targetJoystick)
    {
        operation.Complete();
    else
    {
        operation.Reset();
    }
}
austere grotto
#

ah yeah that might do it

rigid hinge
#

I'm using Unity 6000.3.6f1 and Input System 1.18.0. When I modify an existing Action or add a new ActionMap to an InputActionAsset and click Save Project, the asset is not dirtied and no changes are reflected.

austere grotto
rigid hinge
austere grotto
#

Save Asset is a button in the Input Action Asset window

vale kiln
#

would new input system be suitable for something similar to goat sim? or should I stick to old?
main features:
-enable/disable ragdoll
-attack npc, enable their ragdoll/ send them flying

#

from what I understand I can do the first feature, but second I'm not sure

austere grotto
#

the features you're discussing have almost nothing to do with input processing itself

fierce compass
#

the input system is nearly a superset of the old system, save for built-in axis smoothing afaik

vale kiln
#

ah I mixed up with something else then, thank you very much šŸ™

west isle
#

Does anyone know how to fix this? I got a PlayerController script from youtube and I tried adding SmoothDamp and making forward relative to the main camera rotation but now I have this bug where it ignores the SmoothDamp and holds the key for a bit longer after I let go before it stops without using SmoothDamp. I tried using AI to help but it didnt help me fix it.

cobalt mossBOT
# fierce compass !input
How to Set Input

To set Active Input Handling, go to:
Project Settings > Player > Active Input Handling

• Input Manager (Old): Use the original Input settings.
• Input System Package (New): Uses the new input system package.
• Both: Use both systems.

fierce compass
#

also yeah don't use AI at this stage in learning lmao

fierce compass
#

!code

cobalt mossBOT
austere grotto
#

so now instead of having a smooth slowdown, you just get full speed until smoothdamp finally reduces you to 0

#

normalization always sets the magnitude to 1

#

So you have something like this happening:

Smoothed   Actual (normalized)
1          1
.8         1
.6         1
.4         1
.2         1
0          0```
west isle
#

Oh i see

#

It works perfectly now thanks

#

its really hard for me to understand movement

#

Vectors confuses me

austere grotto
#

It's one of those things that requires spatial reasoning and spatial reasoning is one of those things that some people are just good or not good at

#

But with practice it should get better

west isle
#

ahh alr

wise anchor
#

I'm a beginner in Unity, and I had an old movement system. It uses the old input system, which is deprecated. I plan to make a large project that will last 1-2 years, so should I rework the movement system right now to move to the new system? Or is it okay to stick to my old system.

austere grotto
tired monolith
#

Is there a way to detect if the player hasn't done any actions or inputs?

#
    {
        idleCount = (!hasMovedMouse && directionVector == Vector2.zero && !pressedJump && pressedMouse) ? Mathf.Min(idleCount + Time.deltaTime, idleTime) : 0;
        isIdle = idleCount >= idleTime;
    }```
#

I'm currently using this custom code to detect if any actions werent taken in a certain time, and I was wondering if there is a better way to do it without having to add a new condition every time I add a new action

austere grotto
#

Or if you're using PlayerInput you could use C# events mode and subscribe to the onActionTriggered event

#

But the iterate over all actions thing could be as simple as:

private bool CheckForActiveInput(InputActionAsset asset) {
    foreach (InputAction action in asset) {
        // IsPressed() is true if a button is held or an axis value is non-zero
        if (action.IsPressed()) {
            return true;
        }
    }
    return false;
}```
cobalt mossBOT
#

success @sean_patrick015 muted

Reason: Too many messages in multiple channels
Duration: 29 minutes and 57 seconds

fierce compass
#

especially going negative

austere grotto
oak rock
#

i have this binding which enables a bool InteractPressed if performed. i set a really high deadzone for it just to test if the deadzone worked. even if i very lightly press up on the stick, InteractPressed is set to true. is this intended?? i figured action.performed would only run if the binding was past the deadzone

fierce compass
#

is this a value type action?

#

it seems like it may make more sense to be a button type action, and then set a pressPoint

oak rock
oak rock
#

per the docs, if a composite vector is set to Digital or DigitalNormalized, each value is set to 1 or 0 depending on if the stick is greater or less than the press point.

i set the press point to 1.1 (which, im pretty sure is impossible to reach on a stick as the maximum is 1) but im still getting outputs as if there was no press point at all. if i very lightly push the stick, it registers a non-zero vector

austere grotto
oak rock
#

Or is there some other way to access the press point for this purpose that doesn't require the press interaction

dense ridge
#

I used the rebind sample to add keyrebinding and I adjusted the script to save and load the key but its inside the script and the loading only happens if you open the menu. Is there a way where i can get reference to the rebindUI script so I can just call the loading stuff when the game loads as I don't want to in the same frame at the start open and close the settings menu on that page?

austere grotto
oak rock
#

I basically want the stick to register 0 while in the deadzone and then 1 while out of the deadzone

#

I've done it via code but I was hoping the input system itself would have that functionality

acoustic gull
#

Hello i'm sry to bother you but i have a small prob. I tried to use a key to use a spel on my project and i told on it to only be used during the press and not the press and the release. Then i send event on my Playmaker state but it still send it twice, on during press and one during release do you know why?

fierce compass
acoustic gull
#

Ah ok thanks you !

vapid island
#

goys

#

i got this issue

#

The new unity input system is not reading the mouse delta in a windows build for some reason

#

im calling the readvalue in update

tame oracle
austere grotto
heady slate
#

would someone be able to help with this?

#

im trying to make controller work on a pause menu but its not working. I was following a tutorial and this error happened

austere grotto
#

That's not a built in Unity type

#

so it would be something from the tutorial

heady slate
#

i figured it out but thanks

dense raft
#

I was researching how the input system works and came across a reddit post where someone said this. Why would you not move the character inside of the OnMove method? that's what i've been doing so far and it seems to work fine šŸ¤·ā€ā™‚ļø

#

or maybe i h avent and im dumb

austere grotto
granite apex
#

What is the approach when input must be contextual? For example, a confirm for building placement will be a movement order in another context. Should I switch between maps for each context? Or I just need a lot of specific actions disregarding their wiring to buttons?

verbal remnant
#

mind that spearate action maps isn't the whole solution, you also need to build your systems in a way that separate maps actually work, and your modes need to enable/disable these maps consistently.

#

if you have a state machine somewhere that controls your modes or mode flow, maps will naturally slot into that

granite apex
austere grotto
#

There are several ways to handle the context switching stuff

#

for example a state machine or maybe having the various contexts inject their action into the input listener with delegates

granite apex
dense raft
#

this is probably a dumb question, but is it possible to have two different input systems with the same action and the same keybinds? I'm trying to make it so that the camera moves with A and D but the player can only move with W and S. I put the camera under an empty object with a player input component. The camera works but the player isn't moving for some reason

austere grotto
#

Did you have two PlayerInput components in the scene at once?

#

Each PlayerInput component is meant to be mapped to a single human player - and will take exclusive control of one set of input devices (as defined by your control schemes)

#

If you're not making a local multiplayer game, you should not be putting more than one PlayerInput in the scene

dense raft
austere grotto
#

like referencing other scripts and calling methods on them

#

I would not recommend using Find, no

#

Just directly reference it

dense raft
#

oh wait im dumb ofc

austere grotto
#

There is no reason to ever use the old input system

#

And just for your knowledge - the PlayerInput component is only one of many ways to use the new one

dense raft
#

what are some other ways? thanks for the help lol

dense raft
#

🫔

whole gust
#

how do i create a player camera with the new input system

toxic lintel
austere grotto
viral flicker
#

I have a weird bug where if I press the join action on my keyboard, the prefab is destroyed instantly. this doesnt happen in my controller mode though weirdly enough

austere grotto
viral flicker
austere grotto
#

so find all the places you're destroying anything, and add logs to them

viral flicker
#
DESTROYED... 
UnityEngine.MonoBehaviour:print (object)
PlayerInputController:OnDestroy () (at Assets/Scripts/PlayerInputController.cs:85)
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)
#

this is the stack trace

#

looks like its getting destroyed by the input system?

fierce compass
#

oh that's a message, whoops

austere grotto
#

This is just the OnDestroy yea

fierce compass
#

do you have a Destroy action

#

just a quick sanity check

viral flicker
#

so i guess it just deletes itself

#

so i removed the mouse and it works

viral flicker
#

i have a horizontal layout group, and when i press control child size it just sets all the widths to 0. why could this be happening?

austere grotto
#

Control child size will essentially take over the children's sizes based on LayoutElement and/or Graphic components in the children

#

If they're just empty rect transforms I could see it making them 0

#

Try adding layout elements

viral flicker
#

okay, turns out i have to force expand

austere grotto
tidal cargo
#

I get the error InvalidOperationException: Cannot read value of type 'Vector2' from composite 'UnityEngine.InputSystem.Composites.AxisComposite' bound to action 'Player/Move[/Keyboard/a,/Keyboard/d]' (composite is a 'Int32' with value type 'float') when I Try to test out my 2D movement input

#

this is the Code:

using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    public float movementSpeed = 10.5f;

    private Rigidbody2D playerBody;
    private Vector2 direction;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Awake()
    {
        playerBody = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void OnMove(InputValue pls)
    {
        direction = pls.Get<Vector2>();
        Debug.Log(pls.ToString());
    }
}
austere grotto
#

looks like it's set up as a 1D axis

tidal cargo
austere grotto
tidal cargo
#

what should I use instead?

austere grotto
#

It depends

#

what's your goal here?

#

do you want a 2D axis, or 1D?

#

If you want 2D - fix the input action
If you want 1D - fix the code

tidal cargo
austere grotto
#

A 1D axis will simply return a float

tidal cargo
#

so replace Get<Vector2>() with Get<float>()?

austere grotto
#

Yes but also:

private Vector2 direction;```
with
```cs
private float direction;```
#

you probably want to be doing Debug.Log(direction) not pls.ToString() as well

tidal cargo
#

Well it now gives me the values I want but the RigidBody wont move at all

#

Updated code:

using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    public float movementSpeed = 10.5f;

    private Rigidbody2D playerBody;
    private float direction;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Awake()
    {
        playerBody = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        playerBody.angularVelocity = playerBody.position.x * direction * movementSpeed * Time.fixedDeltaTime;
    }

    public void OnMove(InputValue pls)
    {
        direction = pls.Get<float>();
        Debug.Log(direction.ToString());
        
    }
}
austere grotto
#

it's also...
oddly using the player's current x position as part of that?

#

likewise also oddly multiplying Time.fixedDeltaTime into it

#

there's a bunch of weird things here. But if the object is at x = 0 at the start here, it's definitely not going to do anything, not even rotate

#

since 0 times anything is 0

#

My suspicion is that what you actually want is:

playerBody.linearVelocityX = direction * movementSpeed;```
#

(double check that movementSpeed is not 0 in the inspector as well)

tidal cargo
austere grotto
#

Try what I wrote instead

tidal cargo
#

Yup I alt + entered the solution

#

Its working now

glass tangle
#

How can I move an "On-screen stick" using the stick of a gamepad?

viral flicker
#

something i've noticed on the input system, if you try and spawn a player input using the player input manager, and you dont have the required devices available, it will spawn and then immediately delete the object silently. I feel like there should be a warning or error for this

austere grotto
viral flicker
#

I'm having trouble with using virtual mouse, the pointers dont work. I know its not the issue with the UI elements, because if i add the mouse as a supported device, the hover stuff works fine. what am i missing here?

glass tangle
austere grotto
glass tangle
#

But it's late

#

I create my custom script to moving stick on screen using to phyisical joystick

austere grotto
glass tangle
viral flicker
#

@austere grotto i've been making great strides in this virtual mouse business. as it turns out, I need to give each Virtual Mouse their own user specific input action reference. They were all using the global one, which meant everyone could control them. Another issue I had is that if there were 4 active UI Input modules but only 1 marker, that marker drove all 4 of them. If there were 2, Number 1 would only use the first UI Input module, but number 2 would have 2 3 and 4. as such i'm just disabling and enabling these as necessary

austere grotto
viral flicker
#

now I know for the future

#

this shit is not for the weak

#

also when i click it seems to also instnatly click the button

#

but thats soemthing i will figure out tomorrow its too late lol

toxic kraken
#

I don't understand why I can't get the input system to work.
It detects the key:

      if (Keyboard.current.wKey.isPressed)
          Debug.Log(ā€œWWWWWā€);

But it can't read from the input.

public class PlayerMovement : MonoBehaviour
{
    PlayerInput playerInput;
    InputAction moveAction;
    void Start()
    {
        playerInput = GetComponent<PlayerInput>();
        moveAction = playerInput.actions.FindAction(ā€œMoveā€);
        if (moveAction != null)
            moveAction.Enable();
    }

    void Update()
    {
        if (Keyboard.current.wKey.isPressed)
            Debug.Log(ā€œWWWWWā€);
        Move();
    }

    void Move()
    {
        Debug.Log(moveAction.ReadValue<Vector2>()); // always 0,0
    }
}
austere grotto
#

Can we also see how the individual bindings in the 2d vector composite are configured?

fierce compass
#

also show how your events are setup

austere grotto
#

well they simply aren't

fierce compass
#

you seem to not be using that PlayerInput, really?

#

yeah

austere grotto
#

but what they're doing in the code should still work ostensibly

toxic kraken
austere grotto
#

don't crop anything

toxic kraken
austere grotto
#

Can you turn Collapse on?

#

Also I assume you're pressing WASD keys at some point?

toxic kraken
#

It was my first project, I wasn't afraid to delete it, so I deleted it and created a new one. I tried again and it worked.

austere grotto
#

Ok... it probably would have been easier to just figure out the issue here and fix it

#

Plus we would have learned something

glossy jacinth
#

Heyo, I've encountered a weird issue in the old input system, where it seems I can't properly combine modifier keys with numpad keys..? Namely, say I try to use Shift + Keypad8 (via Input.GetKey).

  • with numlock turned on, Unity properly receives Shift being held down, but the moment I press Keypad8, GetKey on shift returns false, and returns true again once I release the num key
  • with numlock off however, things behave as expected..? Except with numlock off, shouldn't the 8 behave as an UpArrow?
    In both cases, UpArrow key isn't recognized as being held, and in both cases Keypad8 is being triggered correctly, the only issue is Shift not working alongside it, and only if numlock is on.
    I have honestly no idea what causes this and didn't find anything on this. It doesn't seem like it should be like this, no?
    Edit: Switching from Shift to Control fixes the issue and things behave properly with both numlock on or off, so I guess this is a non-issue now, but I still don't get why the weird behavior.
austere grotto
viral flicker
#

is there a way to get devices and their values that aren't connected to a player input yet? I want to use the cumulative values of the sticks to control a marker

#

I don't think they would be connected to input actions just yet, though

weak cypress
#

there is, but honestly its much less intuitive than using the new input system

#

id highly reccomend connecting it to inputactions

viral flicker
blissful quiver
#

how do you use the new input manager? i tried following with an official guide, but unity still was telling me that i'm using the old input manager in my code.

fierce compass
#

so it may just be that

#

actually, there's quite a few warnings/errors that say something along those lines. i may be thinking of a different one. could you show the exact message you're getting?

blissful quiver
blissful quiver
#

is it specifically 3d?

fierce compass
#

no

blissful quiver
#

thanks

smoky meadow
#

wassup ppl
I’m trying to create a movement system for my character, does anyone know any good tutorials out there?
(The game I’m working on is similar to games like Super Mario 64 or A Hat in Time)

cobalt mossBOT
fierce compass
#

start there

#

or google around

weak cypress
# smoky meadow wassup ppl I’m trying to create a movement system for my character, does anyone ...

In this video, you will learn how to implement the new input system in Unity, as well as the mobile controls in your Unity project. This time, you will be configuring a 3D project, which is slightly different in terms of settings for the new input system. This video is the continuation of the 3D platformer tutorial series, which was paused in Ap...

ā–¶ Play video
#

quick google search

#

skimmed through it, seems okay

#

implement something for moving the camera around as well if you'd like

small tiger
#

I have deleted the default Player input action map and created a new one called Board. Why is this not being updated to the actual asset visable on the right? I have pressed save and it does nothing. When I reimport the file my changes get removed and replaced by the old ones. How do I solve this?

austere grotto
#

right click and reimport it

small tiger
austere grotto
#

(or maybe preferences, IDR)

small tiger
#

When I right click > reimport then my changes get removed and replaced by the defaults.

austere grotto
#

I know the issue

#

you're trying to edit it from the Project Settings -> Input System settings menu, since it's the project-wide actions asset

#

you should just open the asset directly and edit it there

#

It's buggy if you try to edit it from project settings for some reason

small tiger
austere grotto
small tiger
#

Oh I clicked save and now it works!

#

Thankss

austere grotto
#

BTW are you actually using the "project wide actions asset" thing?

#

That's only in use if your code is using InputSystem.actions somewhere

#

if you're not using it, you could consider removing the asset as the project-wide asset, and then you won't fall into this trap again

small tiger
austere grotto
small tiger
#

Ahh ok

acoustic tinsel
#

Hi! I have the new input system set up and now I'm trying to find a way to detect which kind of input the player is using so I can dynamically swap my button prompts (Xbox controller, Dual Sense, keyboard, etc.). Is there a resource for how to do this? Anything is greatly appreciated!

austere grotto
#

(this is a sample for a rebinding UI but it also has icons for xbox and PS controller buttons etc so I think they do what you're talking about in here too somewhere)

acoustic tinsel
supple crow
#

I was going to say that I also used the current control scheme name, buuut

#

I don't :p

#

I have a bunch of IconSet SOs; each one tells me the sprites for a list of bindings

#

(i have multiple sprites because i've got colored/uncolored and outlined/filled icons)

vagrant gale
#

I want to add 'Z' and 'Space' to the UI button click control.
I tried to do that by adding Z and Space to both the 'Click' and 'Submit' actions in the Input System settings (see attached image), as well as adding Enter to 'Click'.
(Note: Upon further testing, it seems that the keyboard button press is governed by 'Submit')

I expected all three keys to have the same effect, but only Enter seems to work. For example, I have a pause menu where the player can select an action (e.g. Restart Level) and then press it to reload the gameplay scene. However, it seems that only Enter works as intended, while Z and Space do nothing (i.e. they do not trigger the OnClick() action).

The EventSystem and Button components are not meaningfully modified from their default values, and the correct EventSystem object is linked to the buttons.

#

Detecting the actual input through something like the following code shows that the input action itself is correctly detected, and the problem is that the button does not recognize Z and Space.

InputAction pressAction;
InputSystem.actions.FindAction("Submit"); // Also tested for "Click"
if (pressAction.WasPressedThisFrame())
{
    Debug.Log("button press control pressed"); // Correctly logged when pressing Z or Space.
}
austere grotto
#

Make sure the changes actually got saved there

vagrant gale
#

it is indeed saved there

#

I found the issue

#

Apparently, the actions assets is set to whatever this is

#

I have no idea where it is on my project (it doesn't even show up when i press the circle thing) but apparently it does

fierce compass
#

double click it

#

it's from the input system package itself iirc

vagrant gale
fierce compass
#

iirc the circle selection menu will only show project assets, there's an eye icon that lets it show package assets as well

vagrant gale
#

apparently not even that shows the thing

#

weird, but at least the issue is fixed

minor solstice
#

so uh I have a very simple problem with the new input system. I'm using Gamepad.current != null to check whether or not there is a controller connected. Even though there is no controller connected, it still detects one. What gives?

austere grotto
#

Are you using on screen controls

minor solstice
#

no on screen controls and yes I tried debugging by using Gamepad.all.Count (it's 1) and the name, which yes is the name of the controller I'm using

#

from what I'm seeing it's because Unity keeps a record of registered controllers?

cobalt mossBOT
#

success @amit013140 muted

Reason: Too many messages in multiple channels
Duration: 29 minutes and 57 seconds

toxic lintel
#

I'd set some breakpoints in the input system itself to see where it goes wrong, and what it's detecting.

#

Good chance the OS is sending it the bogus gamepad, though

austere grotto
minor solstice
#

I'm not

#

Unity detects one even though it's not connected

minor solstice
wheat charm
#
   public void OnGrab(InputValue value)
    {
        GrabIsPressed = value.isPressed;
    }

So my GrabIsPressed isn't resetting, even if i have GrabIsPressed = false; after the value is being checked

fierce compass
#

how is Grab set up?

wheat charm
fierce compass
#

yes

#

what type action is it, do you have any interactions

#

is this meant to be held down or pressed and immediately released

wheat charm
#

It is meant to be pressed down

fierce compass
#

so as a plain button action, it'll only be calling OnGrab when you initially press it

#

if you need a boolean of whether it's held down right now, add an interaction and set it to press & release

wheat charm
#

Okay thanks

austere grotto
#

If they're using SendMessages (judging by the InputValue, they are) it should be calling OnGrab on both press and release by default šŸ¤”

fierce compass
austere grotto
#

the default is:
started/performed on press, canceled on release

fierce compass
#

is that not press only

austere grotto
#

Ah I see what you mean

#

Sorry, what's actually relevant is not the phases but how SendMessages works

fierce compass
#

no way, googling "unity input system" gives the first result as the latest version of input system

austere grotto
#

which if I understand sends it on both press and release - but maybe you're right maybe it only activates on performed šŸ¤”

fierce compass
#

and i'm fairly certain that's how it works because i'm using messages in my own code and for most button inputs i don't even receive the inputvalue
-# (referencing old code because i haven't actually written unity in quite a while)

austere grotto
#

yeah you might be right about this - it probably just proxies performed - meaning another way to fix this would be to set it to "Pass Through"

fierce compass
#
    private void OnActionTriggered(InputAction.CallbackContext context)
    {
        switch (m_NotificationBehavior)
        {
            case PlayerNotifications.SendMessages:
                {
                    InputAction action = context.action;
                    if (context.performed || (context.canceled && action.type == InputActionType.Value))
                    {
                        SendMessage(methodName, m_InputValueObject, SendMessageOptions.DontRequireReceiver);
                    }

                    break;
                }
        }
    }
#

the logic is basically this

#

(a lot omitted but not rewritten)

austere grotto
#

I see so it would work for joysticks and axes but not buttons

#

I rarely use SendMessages so I guess my mental model here was wrong.

fierce compass
#

yeah hence a solution being to set press & release interactions, since that gives performed on both press and release

austere grotto
#

yep makes sense

#

Or changing the input action type to Pass Through which makes everything trigger performed

fierce compass
#

that's cool to know. i don't think i've ever touched passthrough

austere grotto
#

(though that could have side effects if it's an axis being used as a button like a shoulder trigger)

fierce compass
#

i work primarily with sendmessages and it wasn't very clear about behavior so i went to the internal code a lot lol

viral flicker
#

how can I lock a virtual mouse to the bounds of the screen?

#

I have these markers, but the player can just fly out of the screen

#

and I don't know how to make it so its always within bounds. i can clamp the position of the graphic, but not the actual input

north tide
#

What is this warning blabbering about?

viral flicker
#

I've got an issue with the virtual mouse, where its calling onpointerenter while its moving, but onpointerexit while it stays still. why might this be?

north tide
#

Also, I set my Player Input compoenent with Invoke Unity Events as the behavior, but I'm not seeing any of my actions available. Just device lost and stuff

#

Bruh restarting unity fixed the issue

umbral lion
#

Is it better to put my code in separate chunks and then run it in the fixed update, or put all of the code directly in the fixed update, and does it make a difference?

vagrant gale
#

I have an Input Asset, which contain two Input Maps
I would like to be able to enable and disable the input asset, and still have each input map keep its state.
Right now, enabling an input asset seems to automatically also enable all input maps within. Is there a workaround for this?

austere grotto
#

Enable() and Disable() on the asset simply enables/disables all of the action maps (and actions) in it

#

Can you explain your use case?

#

I think you probably will just need to track the state yourself.

vagrant gale
#

I have two input maps, Player and UI
When I restart a level, both should be disabled (to prevent sccidental input during screen transition)
When the screen transition is finished, UI needs to be enabled (so that the player can pause and exit if they wish), but Player needs to be disabled (so that inputs aren't registered before the player character enters the screen)
I did fix it by just enabling only UI when restarting the gameplay scene

#

(note: Player off and UI on is the default state in this context, as the player is assumed to be in the pause menu)

glacial yoke
#

guys why can't it understand actions

#

heellpppp plssss

fierce compass
glacial yoke
#

i asked wdym

fierce compass
#

you already asked somewhere else, and you've been answered already

glacial yoke
#

what ok but i've been trynna fix it by finding out everything about action maps so im just asking it here

fierce compass
#

i told you what to check

glacial yoke
#

ik

fierce compass
#

and what was the result

glacial yoke
#

nothing

fierce compass
#

then say so

viral flicker
viral flicker
#

okay as it turns out I had a graphic on the marker with a raycast target still on it...

#

fixed now

nova sapphire
#

I'm getting an IndexOutOfRangeException when I try to confirm a button, only when using controller.

IndexOutOfRangeException: Index was outside the bounds of the array.
UnityEngine.InputSystem.InputAction+CallbackContext.get_control () (at ./Library/PackageCache/com.unity.inputsystem@57d0e36f6123/InputSystem/Actions/InputAction.cs:2140)
UnityEngine.InputSystem.UI.InputSystemUIInputModule.OnSubmitCancelCallback (UnityEngine.InputSystem.InputAction+CallbackContext context) (at ./Library/PackageCache/com.unity.inputsystem@57d0e36f6123/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:2262)
UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.CallbackArray1[System.Action1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at ./Library/PackageCache/com.unity.inputsystem@57d0e36f6123/InputSystem/Utilities/DelegateHelpers.cs:46)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)

#

I'm not exactly an input system expert but nothing here looks particularly strange.

#

This is a button on a loading screen, so there could be something going on there, but I don't think we ever load or unload a control scheme.

#

IndexOutOfRangeException while executing 'performed' callbacks of 'In-Game UI/Affirm[/Keyboard/enter,/Keyboard/space,/Keyboard/numpadEnter,/XInputControllerWindows/buttonSouth]'
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)

#

(the second error that contains the button name)

turbid dagger
#

My game doesn’t support localization yet, I’m using custom sprite based fonts and they current only support english characters. When players with different keyboard layouts use our input rebinding menu, or are presented with tutorials that display inputs, players with different language keyboards are presented with localized strings for these inputs. More often than not this just ends up causing confusion, and for languages with non-English alphabets, the strings can’t be displayed at all. Is there a way to disable this localization? Even once the game is fully localized I can’t guarantee my fonts will be able to support every language.

austere grotto
pastel ingot
#

How would you use the new input system in VS?

austere grotto
#

Visual Studio?

#

The IDE you are using has no bearing on how you use the input system

pastel ingot
#

Sorry Vs as in visual scripting

vale barn
#

Is there no way to multiply each of these with a different value by default?

The gamepad is fine but the mouse (delta pointer) is too fast.

Currently using this:

Vector2 lookValue = lookAction.ReadValue<Vector2>();
#

or do i have to constantly ask which one of these it is and scale it in my code?

If so then how do I know which of these is currently being used?

#

I found it šŸ˜„ Just add a Processor

austere grotto
vale barn
north tide
#

Is it just me or is switching to the "Invoke Unity Events" behavior bugged in Player Input? Every time I switch to it, I have to restart the editor to get access to the actions I set up.

north tide
#

Weird, why is it that when I set up a mouse control, my keyboard controls just... stop working?

#

And by stop working, I mean like even the start of their associated callbacks aren't even being reached

#

Oh, I guess I needed to make a custom control scheme? Kind of weird

glass tangle
#

An quick question

#

How can I debugging the rumble the controls?

#

Is there a specific windows?

fierce compass
austere ember
#

hi, every time i close and re-open unity, the new input system window doesn't save my action maps and i have to re-add them every time. is there a way to fix this?
i'm using inupt system v1.19.0 and unity v6000.3.10f1

fierce compass
fierce compass
austere ember
#

i can't find the save button 🄲 i'm spamming ctrl+s every time though but it's not doing anything

fierce compass
#

try double clicking the asset?

vale barn
#

but then i still have to somehow know which one is currently being used which is annoying

vale barn
#

You'd think this should have been added by default until now

supple crow
#

I prefer going to the former, because that's a multiplication by deltaTime

#

this prevents bad behavior if you get a zero-duration frame

#

(notably, the recorder package can cause this)

#

IIRC, Cinemachine comes with a "delta time" processor

#

I do not remember which way it goes though šŸ˜‰

vale barn
#

I'm not using cinemachine but yeah I'll add the processor for my case

#

thank you guys

austere ember
fierce compass
#

the window you had open earlier was accessing the asset indirectly, through options (and having it set as the default)

austere ember
#

i c

#

so basically this was equivalent of opening up shadergraph or vfx graph or some other separate window

fierce compass
#

i don't have experience with those so i can't say

#

but yeah sounds like it

north tide
#

For some reason, PanCamera is not firing. It's the only callback that's not sending out a log or showing in-game action. Any ideas why?

austere grotto
north tide
austere grotto
#

control schemes are not necessary if you're not doing local multiplayer, and they add unneeded complexity

north tide
#

Ah okay. Good to know lol

#

Still a little confused on why specifically one action wasn't working though (and why the issue seemed to bounce to different actions when I was messing with other components and things)

austere grotto
#

that would be further exacerbated if you happen to have multiple PlayerInputs in the scene

north tide
karmic forge
#

@deft berry If I don't have project-wide inputs enabled does that mean only one of the components will work?

deft berry
#

consider reading the documentation for the component

karmic forge
#

oklemmecheck where i left it

#

it says here they will be disabled

#

they work fine ingame (currently, they're not assigned as project-wide) so im not really getting it

deft berry
#

the PlayerInput component handles enabling/disabling actions so that isn't something you need to worry about when using it
- Boxfriend, 6 minutes ago

karmic forge
#

oh okay and what does that do for my script

#

like when triggering an event or does it do that

deft berry
#

huh? i am purely referring to the actions being enabled by the PlayerInput component. i don't understand what you are asking here in relation to that

#

it doesn't do anything for your script

karmic forge
#

okay so i dont need to use that at all whenever im working on inputs?

deft berry
#

use what? what specifically are you referring to here?

karmic forge
#

enabling/disabling actions

karmic forge
#

okay

#

For actions defined elsewhere, such as in an action asset not assigned as project-wide, or defined your own code, they begin in a disabled state, and you must enable them before they will respond to input.

#

this means specifically the ones i make at runtime?

deft berry
#

no, that means input actions not set as the project-wide one. as i've pointed out the player input component is handling the enabling and disabling of your input actions so that is not something you need to worry about when using the player input component

#

you know, the component you specifically said you are using to manage your inputs

karmic forge
#

nah, not that i mean specifically input system

#

im not worried about player input just yet

deft berry
#

this is all part of the input system

karmic forge
#

this thing

#

specifically

deft berry
#

that is an input actions asset

karmic forge
#

i mean the actions

deft berry
#

what about them?

karmic forge
deft berry
#

jesus christ

karmic forge
#

okay whatever moving on

#

if i get a problem i'll come back to discord and complain

#

and do you know where to find a description

#

of each of these

#

i was scourging api and couldnt find it

deft berry
karmic forge
#

okokthankyou

viral flicker
#

How can I check if any device is pressing / holding down a button?

#

like a certain action

austere grotto
viral flicker
austere grotto
#

e.g. <Gamepad>/* will bind to all Gamepad buttons

#

you could bind it to like <Keyboard>/* and <Gamepad>/* and that will cover most things

viral flicker
fierce compass
#

or might be called "cancel"

#

there's one that handles the respective "cancel" buttons for various devices

viral flicker
fierce compass
#

i feel like you have it backwards

#

you would have the input action check that

#

and then the script just receives infoĀ from the input action

viral flicker
viral flicker
#

is there an event i can subscribe to for when a controller gets connected / disconnected?

sullen iris
#

My new input system is working fine, but there's a weird issue where my input manager doesn't detect a button being held down if it was held while loading into the scene. You have to release and then press again for it to register, which people reported to be an annoyance. One of the controls uses "WasPressedThisFrame" which yeah I understand why that wouldn't trigger, but even an action with "IsPressed" has this issue

#

I have to imagine this is a known thing but yeah was wondering if there was any insight into how that happens

fierce compass
#

iirc there's a checkbox in the input action for that?

sullen iris
#

You mean in here?

fierce compass
#

hmm yeah i don't remember where i saw it

#

one sec

austere grotto
#

this is a Value action

sullen iris
austere grotto
#

it's a checkbox on the input action in this window

#

like I said, buttons only

fierce compass
#

just a tad too slow šŸ˜†

sullen iris
#

Oh, yes I see it, thank you

#

Oh huh it works for "WasPressedThisFrame" too?

austere grotto
#

It should

sullen iris
#

I wasn't expecting that

#

Thank you both, that was the problem :D

viral flicker
#

I havea virtual mouse. If I disable it's gameobject, and reenabled it, it acts as if 0,0 is in the middle of the screen, and not the bottom left as it was before. how can i fix this? (ignore the last 10 seconds of the vid thats me ttrying to turn the video off)

#

the arrows are the virtual mice

tame oracle
# viral flicker I havea virtual mouse. If I disable it's gameobject, and reenabled it, it acts a...

Hey shebb!, When you re enable the virtual mouse GameObject, Unity's Input System resets its state , including the cursor position , so it defaults to (0,0) which in screen space is the center. To fix this, after re-enabling the GameObject, manually warp the virtual mouse position back to where it was (or to your desired default) using VirtualMouseInput.cursorTransform.position or by calling InputState.Change(virtualMouse.position, yourDesiredScreenPos) in OnEnable

fierce compass
viral flicker
fierce compass
#

also, cursorTransform is a RectTransform, i don't think you're supposed to change its position? or is this specific to the virtual mouse

tame oracle
#

Ah yes. you're right ,my bad on the (0,0) thing. Screen space (0,0) is indeed bottom left, not center. What's actually happening is that the VirtualMouseInput's internal device state resets to Vector2.zero on re enable, but the cursorTransform (which is a RectTransform) interprets (0,0) as its anchor point, which is likely set to the center of the screen. And also yeah, you shouldn't set cursorTransform.position directly. The correct fix is to use InputState.Change(virtualMouse.position, cachedScreenPos) right after re enabling, so the input device state is restored and the RectTransform follows naturally. Cache the device position before disabling, restore it in OnEnable

fierce compass
#

i gotta ask, is this from a chatbot

#

maybe i'm just tired but it kinda seems like it to me

sullen iris
#

Not sure though

tame oracle
#

Maybe this is why

sullen iris
#

Ah I see

viral flicker
#

this is the transform of the marker

#

it can go into the negatives normally but

#

when its reenabled it seems to be stuck at 0,0?

#

and it just literal translates it

tame oracle
# viral flicker

can you try to cache the position before disabling and call InputState.Change(virtualMouse.position, cachedPos) in OnEnable to restore it

viral flicker
tame oracle
viral flicker
tame oracle
#

I thought you changed that. It was supposed to work.. can you re check everything?

#

Maybe VirtualMouseInput's own OnEnable is probably running after yours and overwriting the position back, i can't think of anything else :/

viral flicker
tame oracle
#

save it before calling SetActive(false), not in OnDisable

viral flicker
tame oracle
viral flicker
tame oracle
#

in that way VirtualMouseInput never resets šŸ¤”

viral flicker
#

i suppose i could just do that lol

#

save the hassle

tame oracle
#

Yeah šŸ™‚

viral flicker
#

still does the same thing šŸ˜…

#

which is weird because i literally do this already and its fine

#

i'll debug some more

tame oracle
narrow trellis
#

is it worth it to use the new input system? i'm a beginner and i find it much easier to find tutorials on the old input system

narrow trellis
#

what are the benefits

verbal remnant
#

because it has all the features you typically need to finish a game. old input is not sufficient and you always had to build a custom wrapper.

#

if you just want to get input for a small thing, you can use the new system like the old one, e.g. Keyboard.current[Key.Space].wasPressedThisFrame, from there you can make a input action asset where you can define input bindings similar to the old system but with a lot more options. from that you can generate a class that gives you actual C# events to subscribe to and query, or you can use the PlayerInput component to give you generated unityEvents to hook into.

narrow trellis
#

oh that's good

#

ok thanks

verbal remnant
#

you can also go the proper route and reference an input action directly in a serialized field in a script. you can do rebinding, local multiplayer, and swap whole input schemes by just referencing a different config asset (if you set up your code that way)

verbal remnant
# narrow trellis oh that's good

the key thing to understand about InputSystem is the InputAction abstraction. If you think of input actions as buttons, you will have a miserable time with it.

supple crow
#

i've found it to be super pleasant to work with

toxic lintel
#

It's quite complicated and the right way to use it isn't immediately obvious

supple crow
#

there is that large start-up cost, yeah

toxic lintel
#

But yeah, the old one is unshippable in some very common cases

#

I.E. supporting more than one gamepad, or rebinding

blissful lotus
supple crow
#

I'm not sure there's a good way to fix the up-front difficulty of the new input system, other than just telling people "use this one input method and don't even think about anything else"

toxic lintel
#

Maybe a higher level API that sits on top of the new one would be a better answer for beginners

supple crow
#

I find InputActionReference to be very easy to understand, but you still have to turn on the actions at some point

#

i used to have a vestigial PlayerInput lying around strictly to do that

blissful lotus
supple crow
#

(now I explicitly turn each map on and off, so PlayerInput is gone)

blissful lotus
#

However, force bindings for EventSystem using the new system?

toxic lintel
#

Or just do the Unreal thing and provide a set of templates

#

So all you have to do is hook into "movement" or whatnot

supple crow
#

The default input action asset does cover a decent number of bases.

#

okay but one thing it really needs to sort out is mouse vs. joystick input

#

you have to write a processor to scale one by deltaTime

#

well, by unscaledDeltaTime :p

#

i shouldn't have to do that

blissful lotus
supple crow
#

Cinemachine comes with a processor for this, but I don't think the Input System package comes with one

supple crow
blissful lotus
#

Cinemachine is a great example for how input system controls can be plugged in, yes.

#

It's relatively contrived for someone just getting up and going, but in the sense that you can pass input actions as references to objects, it tracks.

viral flicker
#

I have this line of code at the start of this scene, enabling a global action for everyone to use.

back.action.Enable();

I use the player input manager to spawn in player inputs, but for some reason the first player that joins seems to hijack this action, and no one else can press it but them. When I remove all the player input users, it seems to work again. How can I fix this?

blissful lotus
#

Like, if "spawn in player inputs" means that you're spawning an object for each player that commands input actions for those players... that might not be the best way to go about hooking up controls. I hope I understand what you mean here.

viral flicker
#

so I'm not doing any networking stuff

#

Player input manager is for local input

blissful lotus
#

Okay, got it. No spawning objects over a network for secondary callback setups or whatnot lol.

#

Well, my first thought is about the action <=> bindings relationship. back.action.Enable() should enable the action for everyone if there is only the one action. The question then becomes what all is bound to it, which isn't exactly player-owned.

#

You should be able to check back.action.bindings[] to see what exists there.

#

How are you setting callbacks for the action? I'm wondering if you're writing over instead of adding to an event or something.

viscid wyvern
#

Hello, I'm trying to get raycasting to work with the new input system, currently I'm trying to get the name of an object the raycast hits, with the raycast appearing from the spot where the player touches. The method I was using on an older version was:

if(Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began)
  {
    Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
    RaycastHit hit
  }

Then I get hit.transform.name and use that string. Issue is this isn't working on unity 6 and I'm guessing it has to do with the new input system, but I'm not sure. To be clear this is for an AR app on android.

narrow trellis
#

hi!

public void Fire(InputAction.CallbackContext context)
{
  if(context.started)
  {
    // Code to run
  }
}

is there a better way, w the new input system, to run code only when the button is pressed? if i take off the context.started check, it runs 3 times, once for press, once for held, and once for released, & i only want it to run when pressed.

native adder
#

Hey everyone. I'm the sole linux guy on some school projects, and we've noticed weird idiosyncrasies with controller support. Essentially, the game and builds all work fine on windows, but the control layout gets all confused on linux.

I was able to address some of that by launching it through steam, however we have a ready up canvas panel that is just "press A to ready up" and it won't trigger. The A button works fine in all other menus, and it even supports switch pro controllers as well as Xbox correctly. A button means A button.

Any ideas?

oblique raven
#

there are many ways of using the new input system, i tested a few of them, the easiest in my opinion is to use PlayerInput

#
 [SerializeField] PlayerInput myPlayerInput; //add this component to you object and assign it
 InputAction fireAction;

 void Start()
 {
     fireAction = myPlayerInput.actions["Player/Fire"];
 }

 void Update()
 {
     if (fireAction.IsPressed()) Debug.Log("Button pressed");
 }
fierce compass
#

to avoid the magic strings

oblique raven
#

explain

fierce compass
#
-[SerializeField] PlayerInput myPlayerInput; //add this component to you object and assign it
-InputAction fireAction;
+InputActionReference fireActionRef; // assign in inspector

 void Start()
 {
-    fireAction = myPlayerInput.actions["Player/Fire"];
+    fireActionRef.action.Enable() // or enabled in some other way
 }

 void Update()
 {
-    if (fireAction.IsPressed()) Debug.Log("Button pressed");
+    if (fireActionRef.action.IsPressed()) Debug.Log("Button pressed");
 }
oblique raven
#

works too, yeah i mean if you want to avoid using string by any means sure

fierce compass
#

i don't think using a playerinput just to retrieve and automatically enable inputactions really makes sense

#

you can do practically the same thing just assigning inputactionassets

#

(and you don't have to manually enable it if it's the default/global input actions asset, i don't remember what it's called)

oblique raven
#

as i said many ways of doing this. didn“t even know InputActionReference was a thing

fierce compass
#

yeah just saying i don't think this is easiest

#

it's got an amount of indirection there

#

sorry if that came off as argumentative, i read it as trying to showcase the easiest way you found and i saw ways to make it easier

#

or at least simpler, to further that goal

oblique raven
#

all fine mate, i learnt something new

dense raft
#

I apologize if this is a common question, but what is the project-wide actions asset used for? In the tutorials I've done, I just attached it to the PlayerInput component but that gives me a warning. The documentation says that "most projects only ever need a single action asset" which implies that I should be using the project-wide action asset that was created with the project. But again, that causes the warning. Also, the action asset already has an action map for the player, which makes me more confused. Why does the project-wide actions asset have a player map, if I'm not supposed to use it with the PlayerInput component?

fierce compass
#

so generally you'll want to have a input actions asset somewhere, so you can use input actions.
making it the project-wide asset means the asset enabled automatically.
using it in a playerinput means the playerinput enables the asset automatically.

so that's what the warning is about - "if it's used in a playerinput, no need to have it as the project-wide actions. you have access via the playerinput, and it's enabled for you."

#

The documentation says that "most projects only ever need a single action asset" which implies that I should be using the project-wide action asset that was created with the project.
i don't think that's what it implies

#

the default asset is a nice starting point for beginners, but i don't think it's ideal

austere grotto
dense raft
fierce compass
#

well, InputSystem.actions isn't a way to receive input. it's just a way to access an inputactionsasset, just like playerInput.actions

austere grotto
dense raft
#

I remember seeing somewhere that you aren't supposed to handle the actual operations of the object inside of the OnMove, etc functions. Is that true? Why would that be? The way I saw it done was they adjust a float value based on the input and then move it in Update by using Translate and multiplying a vector based off the float.

#

Also, is it best practice to handle input actions (or the results of input actions i guess?) inside of Update? It feels like after a while Update would get very big and things would slow down because its running a million if statements every frame

austere grotto
#

The way I saw it done was they adjust a float value based on the input and then move it in Update by using Translate and multiplying a vector based off the float.
If they are doing movement that needs to run every frame, they used Update. Update runs every frame. That's why they used Update.

austere grotto
#

If it's some kind of "continuous" input handling like a joystick for movement, Update makes a lot of sense. If it's a button press, update makes less sense and event-based input handling might be a good idea. But you can still use traditional polling style input handling either way if you wish.

#

What's important is you understand what your code is doing, when, and why.

dense raft
austere grotto
#

What you're describing is one form of event based input handling yes

#

the new input system supports many different workflows

#

What you're describing is using the PlayerInput component in Send Messages/Broadcast Messages mode. It is indeed one example of event based input handling but not the only way to do it, and not even the only way to do it with the PlayerInput component.

sudden cave
#

I followed along a tutorial and got my player input set up + wrote the script but it doesn't move and I'm not sure why if anyone has any ideas or leads for me on what to look into, the playerInputs move action is set to value and 2d

austere grotto
#

I'm confused

#

why do you have your PlayerInput component in Send Messages mode and then your code is instead manually trying to read the data?

#

Anyway - you need to keep your Console window visible at all times

#

make sure there are no errors in your console when you play

sudden cave
#

not seeing any errors and I'm not sure why its in send messages mode, I didn't change anything about the behavior after creation

#

Created it just by pressing "create actions" after I added the player input in

austere grotto
#

Start debugging your code

#

A few simple log lines and we can see what isn't working here exactly

blazing basin
#

Hey all, i've been trying to add MIDI input to my project using keijiro's Minis MIDI Input extension, but it seems like Unity doesn't recognize my device. Windows itself does recognize it because i can find my device in the "device management" tab of windows. Yet when i try to Listen to key presses or look for any sign of my device in Unity i don't see anything. I realize this is probably quite a niche question but i'm hoping for a helping hand as i'm quite stuck.

viral flicker
#

I have this mouse hovering over an image, and IPointerExit fires but Enter doesn't. How could this be possible?

viral flicker
#

fixed it by changing the player root of the event system

viral flicker
#

how can I perform an interactive rebind with local multiplayer?

#

the way i have it now, if one controller starts an interactive rebind, the other controllers can interrupt that rebind with their own presses

#
currentRebind = action.PerformInteractiveRebinding(bindingIndex)
            .WithControlsExcluding("Mouse/position")
            .WithCancelingThrough("<Keyboard>/escape")
            .WithExpectedControlType("Button")
            .OnMatchWaitForAnother(0.1f)
            .OnComplete(op =>
            {
                action.Enable();
                currentRebind.Dispose();
                currentRebind = null;

                if (SequenceActivated)
                {
                    BindCompleted.Invoke();
                }

                KeybindName.text = PlayerInputAction.name;
                KeybindValue.text = InputBindingName;

                Debug.Log($"Rebind complete! New binding: {GetCurrentBinding()}");
                panel.isRebinding = false;
            })
            .OnCancel(op =>
            {
                action.Enable();
                currentRebind.Dispose();
                currentRebind = null;
                if (!SequenceActivated)
                {
                    action.ApplyBindingOverride("");
                }
                else
                {
                    CancelSequence.Invoke();
                }

                KeybindName.text = PlayerInputAction.name;
                KeybindValue.text = InputBindingName;

                panel.isRebinding = false;
                Debug.Log("Rebind cancelled.");
            });
#

this is my current code

austere grotto
#

e.g.

.OnPotentialMatch(operation => {
            var device = operation.selectedControl.device;
            if (!playerInput.devices.Contains(device)) {
                // If another player presses a button, ignore it
                operation.RemoveCandidate(operation.selectedControl);
            }
        })```
viral flicker
#

lemme check

viral flicker
#

i would like to keep the operation available

austere grotto
viral flicker
viral flicker
austere grotto
viral flicker
#

does the order of the edxtension methods matter at all?

austere grotto
#

oh wait they don't though šŸ¤”

#

XInputControllerWindows and XInputControllerWindows1

#

so that should work I thought

viral flicker
sinful cedar
#

hey guys

#

running into a bug with my playtesting where people with a virtual joystick program (e.g. vJoy) installed are getting phantom input

#

even when the joystick is unpluged

#

is there a way to tell unit to ignore this?

austere grotto
#

Sounds like a vJoy problem.

But you could probably just install vJoy yourself, figure out what the devices are named, and write some code to ignore that device.

hollow willow
austere grotto
hollow willow
#

because im using generated c# input class. It doesnt apply rebind

austere grotto
hollow willow
austere grotto
hollow willow
#

I made my game twice as complex with adding generated class

sinful cedar
#

big thanks

hollow willow
austere grotto
austere grotto
hollow willow
#

Another question, why rebinding doesnt detect keys like "Esc"

fierce compass
still ferry
#

should the UI for the new input system be a separate input asset and not a ActionMap in the main input asset?
moreover, what could cause the right button held from mouse to not affect cinemachine anymore?

austere grotto
fierce compass
#

i understood it to mean whether input actions for UI should be a separate asset vs a separate action map

austere grotto
#

For the vast majority of games you don't need to make your own custom input actions for UI