#🖱️┃input-system

1 messages · Page 17 of 1

austere grotto
#

The default one that goes there is good 90% of the time

ivory bane
#

how do i set the controls the default is none right?

#

the ui works when the input component on the player is off, but the player input doesnt work anyway basically

austere grotto
#

I would recommend simply deleting your EventSystem and recreating it

#

to get the default back

#

possibly clicking ... and Reset will work too

austere grotto
#

you'd have to show how you set this up

ivory bane
#

that code links to this (i know I have it set as the menu action map ill add the real playercontrol aciton map later)

#

is that what you wanted?

#

ive set up the new input system before so idk what I messed up here

sleek pumice
#

Hi. My controls work fine when on PC, whether I use the keyboard or the mouse, but it doesn't work at all on android.
Here are a few information about it, but let me know if I should provide something else.

#

It's not obvious on discord, but there are 3 images:
1- The Input Actions
2- The Button itself. Took the Up, which is W on keyboard, as an example.
3- The script that normally catches the input.

ivory bane
#

well I reinstalled the input system and remade everything and now it works. idk what happened but that was super frustrating. Ty for trying to help praetor

sleek pumice
#

I just can't get it to work...

#

I'm thinking of just flipping it on it's head and mapping all events manually or whatnot.

zenith ivy
#

hey guys. i was setting up actions for my controller when i realized that the game shits itself when i try to fire my weapon. it works fine with a mouse but with a controller it fires more rounds per second evrey time i press/release the right trigger. any ideas how i can fix this?

#

also my weapon wont stop firing

#

PrimaryAttackInputStarted starts a shooting courutine and PrimaryAttackInputCanceled stops any active shooting courutine

austere grotto
zenith ivy
#

alr here it is

austere grotto
# zenith ivy

unclear where this code is running. Maybe share the full scripts as per !code

sonic sageBOT
austere grotto
zenith ivy
austere grotto
#

doing StopCoroutine(shootCoroutine); INSIDE the coroutine is not correct

zenith ivy
austere grotto
#

just use yield break; to stop the coroutine from inside itself

zenith ivy
#

it still shoots more then it should

#

it also wont stop when i release the right trigger

#

but it does stop shooting when the reload starts

#

so thats one bug gone ig

#

i dont know how to explain it. when the trigger is pressed it starts shooting, when it is released it starts shooting again

austere grotto
# zenith ivy

What happens if you use Performed instead of Started?

#

Basically it seems to me like multiple shooting coroutines are being started simulatenously

#

You should use Debug.Log and confirm that is the case

zenith ivy
#

i was just gonna say that

#

gimme a sec

#

performed fixed that but now there is another issue lmao

#

if the trigger is being held then i suddenly release it and press it again more coroutines start and they wont stop until the weapon reloads

austere grotto
#

sounds like canceled isn't running properly?

#

more logs 😉

zenith ivy
#

the only solution

sleek pumice
austere grotto
#

does it work if you get rid of all the control scheme stuff?

#

Android will have a virtual keyboard device from the OnScreen Button but no mouse

#

so I feel the Mouse & Keyboard scheme won't apply

sleek pumice
#

By "get rid", you mean check every box?

austere grotto
#

I mean remove the schemes

#

so the boxes aren't even there

sleek pumice
#

Oh, I'll look into that then.

#

I removed the schemes, and I'm able to still control with my keyboard (once I remapped them)

#

When emulating touch with the mouse it still doesn't work. Haven't tried deploying to my actual device though.

austere grotto
#

like does it dim as you mouse over it etc?

sleek pumice
#

Nope

#

It's supposed to switch to another image, but it doesn't.

austere grotto
sleek pumice
#

I have one attached to that component

austere grotto
#

Attached to that component?

#

that's not right

sleek pumice
#

GameObject, sorry

austere grotto
#

remove it from there

#

create a new one

#

GameObject -> UI -> Event System

#

this will ensure it has the proper components on it - such as the input module

#

and that it's a separate object, which it should be

#

You also need to make sure your canvas has a Graphic Raycaster

sleek pumice
#

When I do that, it navigates me here. I'll delete it before

austere grotto
#

yes delete it first

sleek pumice
austere grotto
#

remove the input module first

#

then the event system

#

then create the new one

#

once that's done ensure your canvas has a graphic raycaster

sleek pumice
#

Seems to work when I click... give me a sec to try it on the device itself as touch.

#

Well it works! Thanks a lot! 😄

#

I have one button that doesn't work, but that must be me messing it up while doing my different tests.

#

(and the game is laggy as hell on my phone, but that's something else I'll have to investigate 😛 )

#

So what I needed all that time was an independant EventSystem, not one hooked to the same object. Great!

craggy dock
#

Hey guys! Please I need some help 🙏🏼

How can I make local co-op with two different gamepads?
I want 2 different player objects answering to the same inputs (same inputActions) from controller 1 for player 1, and controller 2 for player 2.
BUT I do not want to use PlayerInputManager, or PlayerInput.
What can I do?

austere grotto
craggy dock
#

I don t need to handle joining / leaving, I just need for one player to listen inputs from gamepad 1 and another to listen from gamepad 2

craggy dock
#

Also I want the players to be able to play on the same keyboard, but if I use the built in solution I think I won't be able to do so?

austere grotto
craggy dock
#

Ok I see, so not easy with PlayerInputManager..

craggy dock
hazy river
#

anyone know why in the unity inspector player my game works fine, both players can be controlled seperately through keyboard and controller. but when built they both follow controller and neither follows keyboard?

hazy river
#

it seems that if theres a controller connected they both use it automatically despite that both are manually set in the inspector

tough imp
#

I’ve never known how the input asset things work lol, I’ve always used the Input Action in C#, not great for customisable controls but it is easier for me

#

I’ll have to learn it someday

hollow light
#

I have multiple PlayerInput components active at once which causes PlayerInput.ControlsChangedEvent to not be called on either for some reason? Should I just aim to only have one input active at once or is there some other thing causing it not to invoke?

#

For context I'm using it to check which input device is being used and it works fine until there are multiple PlayerInputs active in the scene at once

austere grotto
#

Unless you're doing local multiplayer you should only have one

hollow light
tall olive
#

Hello so i am not really sure of where I should post it but I am getting a real headache on this one:

I am making a multiplayer local game on Unity.
I already managed to make the Input System work and used some controllers put my prefabs everything works really well!

But I want to make a menu before starting the game where somebody could join the game by pressing start on his controller.

The question is how should I do it are there good practices ?
And how can I pass the which controller to which player from my Lobby Scene to my Game Scene when they start the game.

If there are any unity packages references for this kind of stuff I would be glad to look at it

violet ocean
#

Hello, I encountered an issue with setting vibrations on a PS4 controller. It is connected to my laptop via Bluetooth (I tried also via USB though). I tried to use gamepad.SetMotorSpeeds as it is commonly said how to do that, but unfortunately it doesn't work - there is just no vibration.
Yet haptics do work well in some games, so it is not a hardware issue. Now I have no idea on how to deal with this problem, maybe there is a common issue regarding this which I dont know about?

sacred rune
#

I want to make a couch co op game that works like rain world, where there are up to 4 players and you can set controls for each one

#

so for example if you had a controller and your friend didnt you could set player 1's controls to gamepad and friends to keyboard

#

or if you both didnt have controllers you could just do both keyboard but someone has wasd and other has ijkl

#

but it seems the new input system doesn't really support this super well?

still trout
sacred rune
#

i was thinking settings that you can change on the fly

#

thats easy enough thanks to that sample

still trout
#

Well you can use the normal multiplayer function that the input system offers and then use the rebind function that it offers to just put it all to the keyboard on different keys

#

Otherwise if you have fixed sets just make an asset each for the 4key sets and use them for each player

sacred rune
#

the existing PlayerInputManager splits it based on Input Scheme right?

#

that means it might not work

still trout
#

You can have multiple of them controlling multiple root canvases

#

and bind an input asset to a player that has control over it

#

each asset can just contain a few keys on the keyboard

sacred rune
#

How would multiplayer UI input help here? The problem i'm having is that I might have more than one player on keyboard and the normal multiplayer thing doesn't support that from what I can tell. If it split players up based on the action map it would work fine for me (also with rebinding). Also since they are rebindable what if a player does half keyboard half gamepad, I don't know if that works either (it should use the gamepad connected that player index, and then keys should all use the one keyboard in theory)

still trout
#

You can have multiple action assets read from the same device and listen to different keys aslong as you dont bind any device to a player

#

or even action maps

#

only downside is you have to manually listen for the input in code

#
            var inputMapName = _contexts.config.input.InputMap;
            var sharedInputAsset = _contexts.config.input.InputAsset;
            
            _inputAsset = Object.Instantiate(sharedInputAsset);
            _inputActions = _inputAsset.FindActionMap(inputMapName);

[...]

        private Dictionary<System.Guid, System.Action<InputAction.CallbackContext>> GetBindings()
        {
            var configInput = _contexts.config.input;
            
            return new Dictionary<System.Guid, System.Action<InputAction.CallbackContext>>()
            {
                { configInput.MoveReference.action.id, OnMovement }, // MoveReference ->     "public InputActionReference MoveReference"
                { configInput.TurnReference.action.id, OnTurn },
                { configInput.TurnMouseReference.action.id, OnTurnMouse },
                { configInput.ShootReference.action.id, OnShoot }
            };
        }
        private void BindActions()
        {
            var bindings = GetBindings();

            foreach (var (key, value) in bindings)
            {
                var action = _inputActions.FindAction(key);

                action.started += value;
                action.performed += value;
                action.canceled += value;
            }
        }
        
        private void OnMovement(InputAction.CallbackContext ctx)
        {
            var movement = ctx.ReadValue<Vector2>();
            if (movement == Vector2.zero)
            {
                _entity.RemoveMovement();
            }
            else
            {
                _entity.ReplaceMovement(movement);
            }
        }
[...]
#

Just have an up, down, left, right action on all of them and listen for a different InputMap for each player

#

Above some sample code, its not 100% for your situation but you can find the functions you need

still trout
sacred rune
#

I found a keyboard splitter thing that seems to do what I need using the base thing

#

its still hacky tho

#

2 keyboard players and as many controller players

tall olive
#

Hello so I have a problem regarding controllers I have InputDevices that I know are good (I checked their name and connected them with the PlayerInputComponent)
First is an XInput and second is a Keyboard&Mouse

    void Start()
    {
        for (int i = 0; i < GameManager.Instance.InputDevices.Count; i++) {
            var playerInstance = Instantiate(_playerPrefab);
            var playerComponent = playerInstance.GetComponentInChildren<Player>();
            // ...
            var playerInput = playerComponent.GetComponent<PlayerInput>();
            playerInput.SwitchCurrentControlScheme(GameManager.Instance.InputDevices[i]);
        }
    }

But when I try to move them around using this:

    public void OnMove(InputAction.CallbackContext context)
    {
        PlayerInput playerInput = GetComponent<PlayerInput>();
        int playerIndex = playerInput.playerIndex + 1;
        Debug.Log("Player " + playerIndex + " moved");
        for (int i = 0; i < playerInput.devices.Count; i++) {
            Debug.Log("Player " + playerIndex + " has device " + playerInput.devices[i]);
        }
        movementInput = context.ReadValue<Vector2>();
    }

(This is a classic CharacterController with the new Input system)
Both of the players move regardless of the controller and both of them have the two devices...

tall olive
#

So for reference for anyone it is just that SwitchCurrentControlScheme was returning false an issue with the controlScheme directly

still trout
chilly ginkgo
still trout
chilly ginkgo
#

Thank you

agile dragon
#

hello , I'm new in unity and got this messages (I'm using lts 2021 btw) for now there isn't a problem yet but I'm scared later it's gonna ruin something . Do anyone here knows what's wrong and how to solve this ? Thank you so much and have a nice day

Message: Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported since Unity 5.
If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component. Scene hierarchy path "Player(Clone)/Main Camera/pistol_001/pistol_drum_001", Mesh asset path "Assets/Weapons_FREE/Meshes/pistol_drum_001.fbx" Mesh name "pistol_drum_001"

Message : Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported since Unity 5.
If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component. Scene hierarchy path "Player(Clone)/Main Camera/pistol_001", Mesh asset path "Assets/Weapons_FREE/Meshes/pistol_001.fbx" Mesh name "pistol_001"

austere grotto
#

What's your confusion?

#

also what does this have to do with the input system?

agile dragon
#

oh I'm sorry lol just found what i should do i forget to check the convex . I'm sorry if i was at a wrong place when asking🙇‍♂️

silent iron
#

Is this the right place to ask questions about UIButtons and the new Input System?

#

I'm trying to make a button behave like an "OnHold" physical button, that is, that it continuously sends events while its pressed

austere grotto
#

start doing the thing in PointerDown

#

stop doing it in PointerUp

#

Use Update or a coroutine to run code each frame.

#

Not really an input system question tbh, more of a #📲┃ui-ux question

silent iron
#

It works, now.

hazy river
#

how do you refer to a control scheme in scripting?

#

im having trouble with two players in my multiplayer game both using the same control scheme despite being assigned different ones, i was thinking if i can reference them in my movement script i could fix that

hazy river
#

am i correct in thinking that gameobjects with a playerinput component join a playerinputmanager automatically?

austere grotto
hazy river
#

i.e. as opposed to waiting for button inputs orw hatever

compact lantern
#

is there a way to turn off keyboard inputs on UI elements? My movement keys are cycling through my UI elements by default

austere grotto
#

or remove the directional input bindings from your input module

compact lantern
sharp geode
#

same with "joining" players

#

it really depends what your game is

rapid elbow
#

I'm trying to create a util script that sets the time scaled based on holding T+one of the number keys (T+0=0, T+1=0.1 etc, and T alone resets it). However, I cannot find any way to create button combos in the InputActions file. Would I be better off just using Input.GetKeyDown?

austere grotto
#

input handling is separate from that

rapid elbow
#

I'm not sure what you mean. Are you talking about creating actions via code?

austere grotto
#

make 10 actions - one for each number button

#

bind them to the number keys

#

plus an action for the T key

#

the actual code will depend on your preferred method of handling input (ew.g. are you using PlayerInput? The generated class? Something else?)

rapid elbow
austere grotto
#

Everyone goes down this rabbit hole

#

then comes back to creating 10 actions

rapid elbow
#

hehe

austere grotto
#

because it's by far the best and most well supported way

#

It will take you like 1 minute

#

building a workaround will take you hours

rapid elbow
#

Do you know anything about triggering on other Action Maps or do I have to make a new object with a new PlayerInput component?

austere grotto
#

PlayerInput is the only input handling approach which typically has only one actiuon map enabled at a time

#

but you'd have to be more specific about what you mean by that

rapid elbow
#

Would be pretty cluttered to have T and 1234567890 in e.g. the UI map

austere grotto
#

This is much simpler to do if you don't use the PlayerInput component

#

Have you looked into using the generated C# class?

rapid elbow
#

I have never heard of it^

brittle jewel
#

!code

sonic sageBOT
brittle jewel
#

im having coding issues with the input system 2D

#

here or where?

#

2, 17, 39

tulip tartan
#

And what is the issue...

#

I take it those are line numbers with errors or something?

brittle jewel
#

Yes.

tulip tartan
#

And... what are the errors.

brittle jewel
#

namespace, definition, } expected

tulip tartan
#

So yeah, it did look like you were missing a closing curly brace.

#

Can you please just... post the errors? Provide all info up front. Don't make people drag it out of you

brittle jewel
#

Ok wait.

tulip tartan
#

So these are pretty clear. Add a ending curly brace to the last line

Remove the using UnityEngine.InputSystem
That isn't right. Can't remember the right one off the top of my head

Look up the docs for InputValue

#

Wait wait. Do you have the Input System package installed

austere grotto
tulip tartan
#

That DOES look to be the right one

tulip tartan
austere grotto
#

Or perhaps your code is in an assembly that doesn't have a reference to it

brittle jewel
#

Ok, I had did 2 points.

#

The unity top and bottom.

#

Both corrected now.

#

now is the middle, the "Vector".

tulip tartan
brittle jewel
#

I was looking at it.

#

"InputSystem" is underlined.

tulip tartan
#

That's what we were saying about the package

brittle jewel
#

Ok, so it's installed from where?

tulip tartan
brittle jewel
#

Known as the "InputSystem" ?

tulip tartan
brittle jewel
#

Ok, it's installed.

#

That other content looks substantial on the list.

#

Ok, the top line is clear now.

#

The middle "Vector" is problematic now.

#

I got to go, ill bbl.

austere grotto
# brittle jewel

this is because you wrote this:

internal class InputValue
{
}```
#

delete that

tulip tartan
still trout
#

Hey, is there a way to reset a gamepad when opening new UI?

Basically my player is running right through some EXP bubbles and gets level up, triggering the level up UI in which the selection will burst off to the right side instantly

#

Also when on keyboard & mouse I play with the mouse key clicked 90% of the time (shooting), if that UI pops up and I release the mouse key it instantly clicks on the element thats under the cursor

craggy oar
#

hey guys i have a question

sometimes when im starting my game it doesnt register my mouse or something and thats why my character controller doesnt work.
so i have a inputhandler script what is static what execute on [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
and my character controller doesnt work when my mouse isnt on focus but when my mouse focus after the function it doesnt work anymore?

#

does someone has a solution

#

is there a solution that you can force mouse focussing

odd shadow
#

Holy crap guys, I've had this "Bug" with the Input System for weeks, turns out it was just Steams "Big Screen" config in the background adding an extra layer of bindings ontop of my Vector2 + Gamepad Buttons

#

Close Steam = Flawless Split Screen config using Input System

tepid tree
#

Is the input system the best thing to use for navigating stairs?

tulip tartan
lyric mountain
#

maybe make the UI fade in during the time

still trout
lyric mountain
#

eh, that's on them then haha

buoyant adder
#

I'm using a custom render feature to curve my UI. So I need to remap canvas raycast positions from the mouses position on screen to the point on the canvas that gets warped there by the post process curvature. I've got a handy function that convers screen coordinates to curved canvas coordinates, but I can't for the life of me figure how to actually interface with the canvas.

brittle jewel
#

My animator is not working.

tulip tartan
brittle jewel
#

i'll head to animation

#

ty

fading wagon
#

Hi

#

i'm having some issues with the new Input system

#

I need to manage local multiplayer

#

but when on the main title screen and someone press any key i add a new player instance with the player input manager

#

it create a player with the right control scheme assigned

#

and then i want to disable the addition of new player so i deactivate the player input manager

#

and i want the newly added player to navigate in the menu

#

but if i pressed a button on the gamepad it can then be used in the ui to navigate...

#

is there anyway to tell the Event System for the UI to only listen to the control scheme of the available player input?

austere grotto
fading wagon
#

yeah i tried using it but maybe i don't understand how to really use it

#

i replace the actual Event System with the multiplayer one

#

and assigne the root gameobject to be the canvas of my ui

#

but it doesn't change much

#

Should i create an instance of the menu inside the player input gameobject?

#

so that only that player can interact with the menu?

wide grotto
#

I have a TextField that Im drawing using this and I want to listen for tab, arrow keys and return presses while the user is typing in the field. The problem is that Input.GetKeyDown checks seem to be blocked whenever this TextField is being used. Anyone know of a solution to this?
_input = GUI.TextField(new Rect(10f, y + 5f, Screen.width - 20f, 20f), _input);

austere grotto
karmic zephyr
#

Good evening, I want to use WASD to rotate an object in all directions, how can I bind this? I tried adding up,down,left,right binding but it didn't show up

austere grotto
#

Action Type -> Value
Control Type -> Vector2

#

then it will show up

sleek prawn
#

unstable mouse sensitivity when using cinemachine input provder - tried the fix to divide the input by delta time but still doesn't fix it - the only code I have touching the sensitivity is just to set the sens on Void Awake so that shouldn't be affecting it, but here's the code anyways:

            if (_cinemachinePov == null)
            {
                _cinemachinePov = firstPersonCam.GetCinemachineComponent<CinemachinePOV>();
                var currentSens = _cinemachinePov.m_VerticalAxis.m_MaxSpeed;
                var newSens = currentSens * sensitivity / 100;
                _cinemachinePov.m_VerticalAxis.m_MaxSpeed = newSens;
                _cinemachinePov.m_HorizontalAxis.m_MaxSpeed = newSens;
            }
            else
            {
                var currentSens = _cinemachinePov.m_VerticalAxis.m_MaxSpeed;
                var newSens = currentSens * sensitivity / 100;
                _cinemachinePov.m_VerticalAxis.m_MaxSpeed = newSens;
                _cinemachinePov.m_HorizontalAxis.m_MaxSpeed = newSens;   
            }
            

this is actually murdering me as I have no idea why this is happening lol

rapid elbow
#

Is it possible to have multiple action maps enabled at the same time?

austere grotto
#

Yes

#

There's only one circumstance where that isn't the default case and that's when you use PlayerInput's SetCurrentActionMap

glass plaza
#

For some reason Unity's new input system no longer recognizes my keyboard & mouse. It worked fine before but not anymore:

#

Ok found it, I had two Player Inputs in the Scene

terse monolith
#

Hello, I am having problem with the new input system, everything works untill I close and reopen the project. Just so I dont jam a lot of the code here here are links to reddit post and unity answers post I made where you can read the code I wrote for it:

https://www.reddit.com/r/Unity3D/comments/17xdqzn/new_input_system_problems/

https://discussions.unity.com/t/new-input-system-problems/313684

If anybody has any ideas or knows how to solve this, I would really appriciate it 🙂

Reddit

Explore this post and more from the Unity3D community

austere grotto
#

OnEnable on the Pickup script is running before Awake on the Input Manager script

terse monolith
#

I will check that out, I was thinking it was an execution order thing but it did not make sence since while I am in the project it runs everytime, as soon as I close and open it, it breaks. It doesn't break while I'm in the project.

Looking into monomanager

austere grotto
#

NullReferenceException is pretty unambiguous

terse monolith
#

the null reference points to ``` public InputAction @Action => m_Wrapper.m_Movement_Action;

#

Looks like changing input manager execution order to -100 worked
Thank you for the help!

elfin breach
#

Not sure if this is the right channel, but I have questions about using the Backbone controller on my iPhone.
I recently created a test build of my game. After getting the game to run on my iPhone, I hooked up my Backbone controller and all the buttons work perfectly except the left and right joysticks. The left stick does move my character, but its janky. Up is right, down is left, right is down, etc. Its all out of wack. My right joystick that controls where I look doesn't respond at all. I've messed with different joystick configurations but there are so many I'm not sure which one to use. Anyone have thoughts on what joystick config to use? Also has anyone else attempted to use the Backbone on their iPhone builds and found success on their controls? I'll paste a screenshot of my input setup for my Move action.

hollow quest
#

So lets say in my code I get an action map like this

#

And then register a new action like this

#

Is it the expected behavior, that disabling it like this, wont disable the newly added action?

austere grotto
#

I would expect disabling that action map to disable all the actions inside it. But it's unclear from the second line if the action you're subscribing to is in the action map that was disabled or not

#

if it's in the disabled action map, I would expect it not to fire any events.

#

otherwise it will be unaffected

#

Also disabling the action map doesn't remove any event subscriptions

#

it only disables the events from being fired

#

maybe that's where your confusion lies?

hollow quest
#

right, bad wording on my part, the action DOES exist but it's not mapped on game start

#

in my case the action i map's action map seems to be properly disabled

#

becomes this:

#

in my case it's _activeActionMap

#

but for some reason it still triggers when i press the key

#

and this where i map it

#

so it is in "Battle"

#

must be missing something

#

(you can see 'input cycle pressed' even though battleActionMap.enabled is false)

fading wagon
#

hi! i'd like to know how does my player movement script can distinguish command coming from the right player and the wrong ones?

#

i have two player Input

#

using SendMessage

#

does the player script has to be on the same gameobject as the playerInput?

austere grotto
austere grotto
fading wagon
#

ah ok

#

the main problem is that i made a ui to insert players but the playerPrefab is juste the PlayerInput itself

austere grotto
#

Sounds like you'll have to restructure that somewhat
add a layer of indirection

hollow quest
fading wagon
#

now i need to find a way to instantiate the real player gameobject in the scene but connect them somehow with the player input

austere grotto
#

it's hard to say without seeing code

fading wagon
#

hold on

hollow quest
#

@austere grotto maybe this is enough to tell?

#

bad link, sec

fading wagon
#

let me check

hollow quest
#

SetActionMapOnEventEnd is what is called in the example above, that disables the actionMap

austere grotto
hollow quest
#

in this case it's mapped at runtime, because the class doesn't exist before the battle is instantiated

#

some other are mapped above because they are from different scenes

austere grotto
#

I don't see anything popping out as obviously wrong

hollow quest
#

damn kk

#

anything i could print you could think of that might give me more info to debug?

#

could also try debug mode maybe, i'm a bit clueless to what could be wrong rn

austere grotto
hollow quest
#

mb

#

seems like, for some reason, the action is still enabled

austere grotto
#

Different instances possibly

hollow quest
#

yeah.. so maybe the first thought I had then.. I'll try to use .FindActionMap everytime and see if it helps

austere grotto
#

more like - wrong instance of the actions asset itself possibly

#

It's unclear where you're calling RegisterInput from and where you got the InputManager reference from

hollow quest
#

yeah does seem to keep the same state..

#

find every time or storing locally seems similar

#

I think i figured it out

#

@austere grotto issue was _activeActionMap not being nulled onEventEnd (144) and then line 108 of the code i shared above, re-enabling it every time i brought up the console, which I guess I've used also every time to check if it was working

shut ingot
#

Any ideas why I'm not able to use the Japanese IME in a Unity game?

#

I want to switch to HIragana mode but it won't let me when Im in game

#

I'm trying to make a typing game

tidal sinew
#

hello, I have this script in which I'm trying to rotate my camera around a player character whenever I press X and C (for left and right)

#

and I'm using the new input system

#

I'm using cinemachine to do the virtual camera and applying the script onto the virtual camera

#
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class RotateCamera : MonoBehaviour
{
    public InputAction rotateAction; // the input action for rotation
    public GameObject player; // the player object
    public float speed = 10.0f; // rotation speed
    private Vector2 direction;

    void Awake()
    {
        rotateAction.performed += OnRotate;
    }

    void OnEnable()
    {
        rotateAction.Enable();
    }

    void OnDisable()
    {
        rotateAction.Disable();
    }

    public void OnRotate(InputAction.CallbackContext context)
    {
        direction = context.ReadValue<Vector2>();
        Debug.Log("rotating");
    }

}

here is my code

#

for now I'm not even rotating anything, just trying to log the message that it's rotating. How can I get the script to use the Camera Movement Input Actions I've created?

#

nothing is being logged at all when I try to run it

austere grotto
#

Then you can pick the action in the inspector

#

You'll just need a .action on it to access the actual action

tidal sinew
#

oh wow thank you so much

odd shadow
#

So to create a respawn logic with Input System, I had to create a Player Parent with the Model/Camera and a seperate input system gameobject. Link that object to my movement script to broadcast events. Now when my player dies, the input actions doesnt deactivate causing the player instance to be removed.

zinc stump
#

@obtuse plover Don't cross-post, please.

obtuse plover
#

Ok sorry i just found this channel after my other messages

#

😦

zinc stump
#

@obtuse plover You can find tutorials on Input System in the pinned message. You'll find information there how to use it in place of old input system

obtuse plover
#

thank you.

azure compass
#

Is there any way to get a joystick position without using unity axis system?

#

I don't want to use the new input system

#

And the old one doesn't allow me to make customizable bindings

#

So I'm wondering how to get joystick's position to make "my own system"

long gulch
#

Hi ı am new to unity and ı am doing a tutorial serries but ı am having an issue can anyone help
its about İnputSystem
theres no 2D vector Composite what should ı choose instead

timber robin
#

Make sure the control type is set to Vector2.

nova patrol
#

Does Unity handle key combination binding? Like in fighting games - when you press 2 button at once, special move will happen. I know that there must be a delay between reading keys inputs (because it would be very hard to press 2 buttons exactly in the same time), but does Unity handle it somehow or I must program this on my side (I'm using Unity Input System)?

gentle forge
#

your wantings is similar to unreal engine input

austere grotto
ivory timber
#

Which of these bindings causes an object of type Button to be pressed. In my game, using this Map by default the Enter is used, but I can't find any enter binding.

austere grotto
#

this is showing actions

#

Are you talking about pressing Enter in the UI to press a button?

#

That would be under the Submit action in your input module - most likely mapped to Submit in this screenshot

#

Again - you're looking at actions here, to see the bindings you need to expand the actions

ancient trout
#

Is it possible to have an event for when the up down left right components of a composite vector are just pressed down individually, I want to track how many times an input has been pressed down, rather when the whole action is performed because that seems to track when the action is also released for the composite vector (which I don't want, I just want an event to trigger when a input pressed down)?

austere grotto
ancient trout
#

Hm, I guess that should work

rose fulcrum
#

Hello everyone. Is there a way to understand when action was triggered by one binding, and when by another binding (with one modifier for example)?

austere grotto
rose fulcrum
#

Well, yeah
But I mean is there a convenient way to do something like this in one action? The thing is that they are very similar, so it would be logical to put both of them in one action and just check if the binding with modifier was called to do some extra actions

austere grotto
#

Maybe a cleaner way to write it:

void Update() {
  if (mainAction.WasPerformedThisFrame()) {
    if (modifierAction.IsPressed()) {
      // modified action
    }
    else {
      // plain action
    }
  }
}```
rose fulcrum
#

Oh, got it. Thanks for your help

ivory timber
#

It is the default when using the Event System of the new Input System. My buttons in my game are pressed with Enter once selected. In addition to clicking on them, which is obvious.

I want to know how to change that enter or add more buttons.

#

By the way, where it says keyboard, there is nothing more than navigation.

austere grotto
#

Add bindings by pressing that + button

#

Since this is the default input actions asset you may need to duplicate the asset to change it

#

(and assign that duplicate to the input module)

ivory timber
#

Yes, I already did that, that's why it has another name. Thank you very much, as I read Any I thought that the binding was like when they tell you: "Press any key"

#

Thankss

#

Works sadok

hybrid nexus
#

Does anyone know how to get mouse and touch input working with the InputSystem on WebGL builds? It appears that it is picking up a touchscreen device on desktop which appears to be consuming my mouse input as touch input. When removing this touchscreen device my mouse input works as I would expect. With the touchscreen device still there my mouse input appears to be consumed by the Touch bindings (e.g. holding left and right mouse button binds to my Touch #1 input)

supple crow
#

I am generating tutorial text from input actions. So far, I just handle (possibly composite) bindings. I want to add in interactions as well.

#

So, I want to be able to spit out something like "Tap 🅰️"

#

I see that each input action and input binding has an interactions string on it

#

Is there a convenient way to parse this string into something more structured?

#

It looks easy enough -- the interactions are comma-separated, and any parameters are enclosed in parentheses

Tap,MultiTap(tapTime=0.2,tapDelay=0.75,pressPoint=0.5)

e.g.

#

i'm not sure i'll ever actually have multiple interactions at once, of course

#

I'm also not sure I need to actually implement a general solution for this. I can probably just stick with checking the action and checking each relevant binding

#

oh yeah, that's perfect

errant echo
#

Im trying to write manager for my code which is connected to multiple scripts

#

Its meant to be for a tutorial so there should be some form of game state and after pressing a button, the state will progress

#

The issue im having right now is that

#
void UpdateState(InputAction.CallbackContext context)
    {
        if (context.performed)
        {
            Debug.Log("Action: " + context.ReadValue<float>());
        }
    }
#

Im only using a single function to update the state, but how do I know where the button press is coming from?

#

I want to identify if the player is moving or the player is attacking using the player controller events

#

Or is that not how I should go through this problem?

supple crow
#

So you're having many different actions invoke the same UpdateState method

supple crow
#

I suspect you could do something like this

#
[SerializeField] InputActionReference attackActionRef;

void UpdateState(InputAction.CallbackContext context) {
  if (context.performed) {
    if (context.action == attackActionRef.action) {
      // ...
    }
  }
}
errant echo
#

ah ok thx

#

Let me give it a shot

errant echo
#

Is it better to use multiple functions @austere grotto

#

Or better to do like one function for everything

austere grotto
#

I said what I said.

rose fulcrum
#

Hello everyone. After merge of branches in GitHub, I've got a broken InputActionAsset. It sends me to some code, but I don't understand a little, how can I fix it... Can someone help with it :(

austere grotto
rose fulcrum
#

It doesn't open

austere grotto
#

the json is invalid

#

did you have merge conflicts in git?

#

Maybe you accidentally committed the merge conflict markers into the file, or resolved the merge incorrectly

#

either way the data is corrupted/invalid

rose fulcrum
#

Where I can get the JSON file to check it? When I click on the error it leads me to this .cs, but it has a lot of try-catches, so I suppose it is not something I search for

rose fulcrum
austere grotto
#

the asset file itself is corrupted

austere grotto
#

the problem is the corrupted asset file

#

either checkout an old version, or go into the yaml and try to fix it manually

rose fulcrum
#

Found the problem, thanks for your help!

clever oyster
#

Hi I cant seem to navigate the UI with the d pad on the steam deck I'm using the new input system then UI navigation when going into pause menu for example , any idea? thank you

austere grotto
clever oyster
#

Seems like with the DS4 on the editor I can use the dpad for UI navigation no problem. I'm gonna try the build with the dualsense and check

#

Maybe is a steam deck issues only

clever oyster
austere grotto
#

ok sounds like a steam deck issue

#

steam deck is weird

clever oyster
#

Yeah 😂 but I love it

#

Maybe I need to install some steam plug ins or something

odd shadow
#

Does this thing do Horizontal?

wintry hawk
#

Hey does anyone know how to attach methods in other classes to the input in another class? So i have a PlayerInput class where I have my awake function to make an instance of my controls, I have the OnEnable and OnDisable functions set up. I have references to other scripts like my interact system. In my interactsystem script it has the method public void Interact(Input.CallbackContext context) and in my PlayerInput I have interact.performed += interactSystem.Dash; But it isn't working.

austere grotto
austere grotto
wintry hawk
# austere grotto You'd have to show your code and explain what "isn't working" means

public class PlayerInput :
OnEnable () {
dash = playerControls.Player.Dash;
dash.Enable();
dash.performed += playerMovement.Dash;
}

public class PlayerMovement :
public void Dash(InputAction.CallbackContext context) {}

The dash works perfectly fine by itself but its not being called even though I tried assigning it in another class. I'm not too sure what this error means ArgumentException: Value does not fall within the expected range.

fringe roost
#

hey! 2 questions, why cant i see the placeholder in this input field ? and when i play the game, i want this input system to be still in its place, not follow the camera, how do i do that?

austere grotto
austere grotto
#

You would need to use a world space canvas if you want it to be stationary in the world

fringe roost
austere grotto
#

if it's moving it's due to some script of yours or a component you attached to it or because you made it a child of a moving objects or something.

fringe roost
#

the canvas wasnt a child of anything, and it only had the input field 😅

austere grotto
#

you'd have to show a video or something, and also screenshots of the inspector(s) of the objects involved

wintry hawk
austere grotto
wintry hawk
#

!code

sonic sageBOT
austere grotto
#

(P.S. I don't recommend naming your class PlayerInput since there's already a component by that name in the Input System.)

wintry hawk
wintry hawk
austere grotto
#

Your problem is playerMovement is null

#

which makes sense because you're not actually assigning it until Start()

#

OnEnable runs before Start

#

You should be doing these:

        playerMovement = GetComponent<PlayerMovement>();
        cameraController = GetComponentInChildren<CameraController>();
        interactSystem = GetComponent<InteractSystem>();```
Inside `Awake`, not `Start`
wintry hawk
supple crow
#

I just noticed that I'm getting really weird input lag on macOS. When I click the left mouse button, mouse movements are ignored for several frames.

#

It seems worse when the game's running at a low framerate. The mouse click itself is also delayed.

#

Other mouse buttons are completely fine.

#

This is happening in every game I've built

#

Aha. Thank you Reddit!

#

er, StackExchange

#

potato potahto

#

an application called Magnet was causing it

#

this might be helpful to someone else searching for this, at least! lemme just throw out more keywords: macos input lag ; macos left click

wraith gazelle
#

is it possible for me to use the input system to trigger a button? i want to trigger an OnClick() when i press a button and button.onClick(); doesnt seem to be working for me :/

charred adder
#

Hi ! so i want to create actions for my player movement
but i cannot select the bind "right stick [gamepad]" for no reason
and "Delta [Mouse]" to

#

"right stick [Gamepad] is unclickable

fallow kraken
#

I'm having trouble to store diagonal input with Unity's new input system.
When I walk top-right, the diagonal animation is played.
When I stop pressing 'W' and 'D', I want to play the idle animation for the top-right direction.
But because it is impossible to release both keys at exactly the same time, it switches to either top or right first depending on what key was released first.
How do I prevent this from happening?

    void OnMove(InputValue movementValue)
    {
        movementInput = movementValue.Get<Vector2>();

        if (movementInput != Vector2.zero)
        {
            animator.SetFloat("MoveX", movementInput.x);
            animator.SetFloat("MoveY", movementInput.y);

            lastDirection = movementInput;
        }
        else
        {
            animator.SetFloat("IdleX", lastDirection.x);
            animator.SetFloat("IdleY", lastDirection.y);
        }
        Debug.Log($"X: {movementInput.x} | Y: {movementInput.y}");
    }
stone dragon
#

What do you mean by "Idle top right direction" ?

austere grotto
#

What you need to do is calculate which of the 8 directions you're facing in C#

#

And pass that into your animator

#

Rather than two independent x/y values

#

Which the animator is too simple to handle

stone dragon
#

I have a quick question btw, is it bad practice to create multiple instances of the same PlayerInput ?

For example, I have two scripts on a same GameObject :

Both of them have something like :

public class HandlingStuff : MonoBehaviour

PlayerInputManager playerInputManager

private void Awake()
{
playerInputManager = new PlayerInputManager();
}

Do you guys agree there is two instance of the same PlayerInputManager? How would you proceed to create a single instance that I can reference to ? (For example, for calling OnMovementInput, OnAimInput etc...)

I hope I made myself clear... Thanks in advance !

silk dove
#

How do I change this default text in the TMP Input Field? Never mind I found in the Placeholder componenet of the Input Field.

austere grotto
#

Because PlayerInputManager is a thing but that's not how it normally works

#

If you want to only create one, you should just create one and share it by exposing a reference to it

austere grotto
#

Movement

#

If you want to do it for camera you need to set it as a Vector2 as well

charred adder
#

Ok thanks you so much it worked !

fiery scaffold
#

Hey! Ive been using the fps package as a template with is using the new input system and I just upgraded my unity version because I really wanted to have volumetric clouds, everything went smoothly except that the starter package got broken and its giving me this error
https://i.gyazo.com/64189c601eedc389ca9cf41238c90e6e.png I cant find any tool drop down and I cant find it in the package manager either, is there something else I should do?

#

everything works except my inputs

shrewd drum
#

hello everyone, I'm sure this has been asked a billion times but does anyone have any idea how to prevent my input system from firing events twice? I tried adding InputAction.CallbackContext context as a parameter and it just throws an error now saying the method is NotFound

austere grotto
#

you also described at least two different problems

#

share the details of how you tried to set things up and we can show where you've gone wrong

shrewd drum
# austere grotto it won't fire events twice by default

sorry, I was under the impression this was a known issue given everything I was reading online. basically I have set it up as simply as possible, as I'm doing a gamejam. I created a PlayerInput with default settings. in my script, I've imported Unity.InputSystem, and I have a public void OnFire() method. but when I put a debug.log on it, it appears to be firing twice when I click the mouse, which is causing double damage to my enemy

austere grotto
#

generally you will get one callback for pressing down and what callback for releasing. You are supposed to disambiguate that in your code

#

it's not really an "issue" just perhaps a misunderstanding on how it works.

shrewd drum
#

is there a way I can easily disambiguate it in my code?

#

I appreciate you taking the time to answer my frantic question lol

austere grotto
#

yes but I can't help you with that without seeing the code

#

and screenshots of your PlayerINput component

shrewd drum
#

I'm digging in further and seeing that you're right, my input IS only happening once but my attack is being called twice, I'm sorry I should have checked that before asking! so now I have a starting point

#

sorry, I feel like an idiot now

#

nothing like a gamejam to make you go nuts lol

white swift
#

My clicks dont get registered when i click on a button

#

what could be the cause?

tulip tartan
white swift
#

@tulip tartan any solution?

tulip tartan
white swift
#

i added a graphic raycaster to my canvas and that seemed to fix it kinda

#

mb im kinda cofused what each channel is for

tulip tartan
white swift
inland quail
#

I would love some help please!

I have a full action Asset defined. I have the action map set in the Ui_EventSystem as well as the PlayerInput. I don't seem to get ANY input from the D-pad, submit or ananogue for scrolling through the menu.

zenith ivy
#

This video will show you how to use controller and keyboard (or any control) to navigate your UI menu in Unity. This will be using the new input system available for download in the Package Manager.

📥 Get the Source Code 📥
https://www.patreon.com/posts/48861194

🤝 Support Me 🤝
Patreon: https://www.patreon.com/samyg
Donate: https://ko-fi.com/sam...

▶ Play video
inland quail
exotic spear
#

If I want to detect the direction from a phone to the ground, do I use the Gyroscope, GravitySensor or Accelerometer?

queen current
#

I'm working on adding mobile compatibility to a WebGL build and it works fine on android/PC but the click and drag motion doesn't do anything on iPhone. We're detecting this movement using Input.GetMouseButtonDown(0) (+ButtonUp). I couldn't find any useful documentation so I just wanted to ask if iOS browsers map that movement to mouse button 1?

round hatch
#
    InputManager input;
    Rigidbody2D rb;
    float propulsionForce = 50f;

    private void Awake()
    {
        input = new InputManager();
        rb = GetComponent<Rigidbody2D>();
    }

    private void OnEnable()
    {
        input.Enable();
    }

    private void OnDisable()
    {
        input.Disable();
    }

    private void FixedUpdate()
    {
        if (input.Player.Move.triggered)
        {
            Propel();
        }
    }

    private void Propel()
    {
        rb.AddForce(Vector2.up * propulsionForce);
        Debug.Log("Propelling");
    }

What's wrong here? I am spamming the move button but it only debugs sometimes. It does it at random times without a noticeable pattern.

austere grotto
#

Input handling goes in Update

teal sinew
#

Having a bit of a PEPEGA moment right now with the new input system. I have my input actions and everything set up, but in my player movement script itself I'm a little confused on how to actually use the new input to move my player? I'm subscribing to my actions and then in the listener I have it set a move direction and add force to a rigidbody, but I think I'm missing a step because when I perform said event nothing happens to the object the script is attached to.
Player Controller Script:

// Public
    public float movementSpeed;
    public Transform orientation;

    // Private
    private Rigidbody rb;
    private PlayerInputActions playerInputActions;
    private Vector2 inputVector;
    private TwoAnimationStateController animCon;
    private Vector3 moveDirection;
    private float horizontalInput;
    private float verticalInput;

    private void OnEnable()
    {
        playerInputActions.Enable();
    }

    private void OnDisable()
    {
        playerInputActions.Disable();
    }

    private void Awake()
    {
        playerInputActions = new PlayerInputActions();
        playerInputActions.Player.Jump.performed += Jump;
        playerInputActions.Player.Movement.performed += Movement;
        playerInputActions.Player.Dance.performed += Dance;
        playerInputActions.Player.MouseX.performed += ctx => horizontalInput = ctx.ReadValue<float>() * 0.1f;
        playerInputActions.Player.MouseY.performed += ctx => verticalInput = ctx.ReadValue<float>() * 0.1f;
    }

    private void Start()
    {
        animCon = GetComponent<TwoAnimationStateController>();
        rb = GetComponent<Rigidbody>();
        rb.freezeRotation = true;
    }

    private void Update()
    {
        UpdateInputVector();

        // Animation
        animCon.UpdateVelocities(rb.velocity.z, rb.velocity.x);
    }

    private void UpdateInputVector()
    {
        inputVector = playerInputActions.Player.Movement.ReadValue<Vector2>();
    }

    public void Movement(InputAction.CallbackContext ctx)
    {
        animCon.StopDancing();
        moveDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;
        rb.AddForce(moveDirection * movementSpeed, ForceMode.Force);
    }

    public void Dance(InputAction.CallbackContext ctx)
    {
        animCon.StartDancing();
    }

    public void Jump(InputAction.CallbackContext ctx)
    {
        if (ctx.performed)
        {
            rb.AddForce(Vector3.up * 5f, ForceMode.Impulse);
        }
    }
}
#

It's probably obvious but I'm not totally sure why my player isn't moving, so any help would be greatly appreciated

austere grotto
#

also this is very confusing because you appear to be trying to handle the movement input in two different ways

#
  1. you do this:
    playerInputActions.Player.Movement.performed += Movement;
  2. you do this in Update():
    inputVector = playerInputActions.Player.Movement.ReadValue<Vector2>();
#

pick one

teal sinew
#

So would I just be calling AddForce in my fixed update with the values from the ctx in my listener? i.e.

  animCon.StopDancing();
  moveDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;

then in FixedUpdate

  rb.AddForce(moveDirection * movementSpeed, ForceMode.Force);
austere grotto
teal sinew
#

Oh i'm really dumb I understand, thank you

#

I've been like frankensteining multiple resources because I couldn't figure it out and the remnants of others has also been interfering with my new stuff

#

For anyone else who may ctrl+f this or was curious, I fixed this issue by doing:

    private void Update()
    {
        // Inputs
        inputVector = playerInputActions.Player.Movement.ReadValue<Vector2>();
        moveDirection = orientation.forward * inputVector.y + orientation.right * inputVector.x;
        
        // Animation
        animCon.UpdateVelocities(rb.velocity.z, rb.velocity.x);
    }

    private void FixedUpdate()
    {
        rb.AddForce(moveDirection * movementSpeed, ForceMode.Force);
    }
teal sinew
#

Sorry had one more quick question, was reading through documentation and I wasn't sure. Is there a best practice for things like holding a button? I see people online suggest something like this:

  playerInputActions.Player.Sprint.performed += ctx => isSprinting = true;
  playerInputActions.Player.Sprint.canceled += ctx => isSprinting = false;

But just figured I should ask to see if there are any problems with this / if there's a better way

austere grotto
#

note that while event based input handling is fine - I wouldn't recommend using lambdas as per your example as you won't be able to unsubscribe them.

#

A third option is just to make it a property:

bool isSprinting => playerInputActions.Player.Sprint.IsPressed();```
teal sinew
#

Yeah I was thinking about that as well, theoretically in this specific use case I think it would be fine(?) but I can see instances where lambdas aren't a good solution. I think I'll take that into account and consider making it a property instead since it's just as clean as a lambda imo.

#

Thank you!

round hatch
austere grotto
#

However - in this particular case since you are doing a "one-off" force, it will not matter if your force is added in Update. That being said, one off forces should be using ForceMode.Impulse or ForceMode.VelocityChange.

round hatch
austere grotto
#

.triggered is only true for a single frame

#

Read the input in Update and add the force in FixedUpdate:

bool thrust = false;

void Update() {
  thrust = input.Player.Move.IsPressed();
}

void FixedUpdate() {
  if (thrust) {
    rb.AddForce(Vector2.up * propulsionForce);
  }
}```
#

for example^

round hatch
#

just realised that the person above had a similar question

rich horizon
#

hey guys, so i am working on a vr game where i can shoot things etc. i am trying to get input from the interactable and i am able to pick it up and all but when i want a action to be triggered in the interactable events category (i want to use activate) i dont recieve anything. it doesnt trigger the function that i am trying to trigger and i cannot find the problem. can anyone help with this problem?

austere grotto
rich horizon
#

yeah also shared it in vr but it is input as well tho so i thought it was something i could post here to

#

i am using the new input system so i dont really have code for it. i am using the package from unity so almost everything is in components that i use on the player and interactable gameobjects

maiden trellis
#

heyo, got a project which is basically a rhythm game, and like guitar hero, when you press the button it changes the sprite of the button, it works fine for all of my buttons, but when i change the scene or when i reload the scene, the green button stops responding. the inputs are the same as the other buttons, the scripts are the same, nothing is different. to make it work again i have to delete the script and apply it again, then it works fine. does anybody have an idea why it's doing this and how i could fix it?

austere grotto
maiden trellis
#

no errors, and ive been debugging for a while lol

#

alright i changed all the buttons to prefabs and now its the red and yellow buttons that dont change sprites :/

#

lol its back to only the green one not working

rich horizon
austere grotto
maiden trellis
#

yeah event system is seeing no problems, when i press the button goes from 0 to 1, so all good there

#

might've found a fix, trying it now

maiden trellis
#

nope nothin

austere grotto
maiden trellis
#

well for debugging you can check in the console, thats mostly what i've been doing, and i can send the code sure

#

even though it shouldnt be a code issue because all 4 of the buttons have the SAME script

austere grotto
#

Printing logs is one debugging tool, yes. You were checking the console for what exactly? Did you add log statements to your code?

maiden trellis
#

yeah, i'm checking which color of button is pressed, and i also checked if the input works, which it does (when i click on the green input binding it changes to 1, but the sprite doesnt change) so it seems it's a unity issue or something

#

ill send the code

sonic sageBOT
maiden trellis
austere grotto
maiden trellis
#

yeah thats what i thought too, but since the code is the same for all the buttons, technically its fine since it works on the other buttons great

austere grotto
#

What is this "GameController"? Where does it come from? What's its life cycle?

maiden trellis
#

its the game manager, just an empty gameobject with a gamemanager script managing things around the game

austere grotto
#

That's not what I asked about

#

I asked about GameController

#

Which apparently has the PlayerInput on it?

#

Where does that come from? Is that a singleton? Is it DDOL?

maiden trellis
#

yeah its the gamemanager lol it just has a gamecontroller tag on it

austere grotto
maiden trellis
#

no idea what a singleton is, but no its not ddol

#

and i dont really understand what u mean by where does it come from

austere grotto
#

Is it in the scene?

#

Is it instantiated?

maiden trellis
#

yes

austere grotto
#

Which one?

maiden trellis
#

all scenes

#

ah i fixed it by putting my gamemanager in ddol i think

austere grotto
#

My point is if you have two of them in the scene for example and you are finding by tag there's no guarantee you'll get the same one

maiden trellis
#

oh no i don't have two of them in the same scene thats for sure

#

nvm its not fixed lol

austere grotto
#

And you can only have one PlayerInput

maiden trellis
#

yeah

maiden trellis
#

still haven't figured it out lol idk whats broken with it

glass tangle
#

How can i do get value negative in the input with the new input system???

austere grotto
ivory timber
#

I want to make a button to skip things in my UI. I want to use the new input system. How should I do it?

young vortex
#

Is there a way to have "custom" data for certain control schemes? For example I want to have user-configurable "look sensitivity" for my look action for each control scheme (mouse/keyboard, PS, Xbox, etc...) that I can retrieve from my c# look script

#

Or would I have to have a separate config file that I load manually to assign to separate c# fields then just check which control scheme is being used in my c# look script and apply the corresponding sensitivity multiplier

glass tangle
austere grotto
meager fossil
#

Hi. I'm developing a rythm game BUT it will be on mobile ANDROID OS.

#

Does the new input system is better than legacy in term of performance? (quick touch response)

#

Which one should I use?

austere grotto
#

Use the new system if you want event based input handling, runtime rebinding support, etc

meager fossil
austere grotto
#

have you confirmed that input handling is somehow a performance problem in your game?

glass tangle
austere grotto
# glass tangle How?

make an action
set action type to Value
set control type to Axis

Add a Positive/Negative binding

meager fossil
iron linden
#

Having an issue where pressing space during the rebind process doesn't rebind the current key to space. Every other key and mouse input rebind properly and pressing space makes the rebind UI blink so it knows a key is being pressed but nothing happens.

glass tangle
austere grotto
#

the data type will be float

#

it will come from either the InputValue or the CallbackContext or the InputAction depending on what style of input handling you're using

glass tangle
#

well, see yourself

austere grotto
#

It would be ReadValue<float>()

#

also what is input? Is it a float?

#

It should be in this example

glass tangle
#

See i want that my controller car is following way:

austere grotto
#

Yes...

#

that's what we're doing

glass tangle
#

Yeah

glass tangle
#

Any idea?

austere grotto
#

I already told you what to do above.

glass tangle
#

ok

spare frigate
#

When I try to edit binding paths, control schemes or anything that generates the devices editor, Unity warns me about Unable to find style 'ToolbarSeachTextField' in skin 'DarkSkin' Used, which prevents that editor from drawing the search bar and "Listen" button properly, and the devices themselves are not interactable even though I can hover over them, clicking them doesnt change the display, ive also tried changing themes + restarting and it still produces the exact same error - I tried in both my existing HDRP project and a new BiRP project, in all my versions 2021.3+ this seems consistently broken, but works fine in 2020.3, all using the latest package - is this just a problem in 2021.3+ or something strange happening? I cant seem to find much about what causes it or how to fix it online other than comments saying "the bug tracker says its fixed but is not actually" Anyone else experienced this?

sterile citrus
#

Hi all. I have a question about consuming events using the new InputSystem package. So I have a ui button that I want the user to be able to click in order to perform some action, but I also have the pointer input set up to interact with the world via a left-mouse click. The problem is that when the user clicks the button, this also fires the "interact" event, which I don't want. The ui button ought to consume the LMB event so that the user does not fire the "interact" event on the same frame. How can I achieve this?

I'm aware of Event.current.Use() which I could put in the ui button callback function, but afaik this is not the same thing as the new input system and doesn't seem to do what I want.

Another solution might be to do a camera raycast to see if the pointer is blocked by UI before performing the "interact" event logic, but I'm hoping there's a cleaner way to do this.

Thanks in advance!

spare frigate
# sterile citrus Hi all. I have a question about consuming events using the new InputSystem packa...

Maybe you could setup different "Action Maps" for the different kind of input you want to split (image is not mine, just an example of action maps), then your UI logic can toggle that action map when its shown/hidden - I do this for my game where I have maps for "navigation" like opening the pause menu, clicking on buttons etc, "player" which are things like movement, jumping etc, "combat" where left click also shoots, attacks, etc - when the pause menu is open, I can disable "player" and "combat" to prevent shooting and moving when you click and press buttons on that screen, then re-enable them when the menu hides - my game may be a bit complex though as I can also have many menus and sub menus active at once, so I use a "manager" to know factors like if any menu is still open, and if the player is still alive before re-enabling input

tranquil rune
#

im using unity's new input system and i want to switch between cameras (from normal to sniper cam)

#

tell me how

#

im a begineer

wanton sorrel
#

ive not used it, but this looks like a pretty good beginner tutorial. https://www.youtube.com/watch?v=HmXU4dZbaMw&ab_channel=BMo. From what I can tell the default input system is a lot more user-friendly, but I can see the advantage this has. other then that good luck ^-^

BMo

The "new" Input System in Unity still doesn't come pre-packaged and is complicated to understand at a glance. It's no surprise new game developers don't know where to look in the engine to find it, or how to use it.

In this tutorial, learn how a beginner can adapt their current project to use the new input system in a simple way, as well as usi...

▶ Play video
austere grotto
tranquil rune
#

then tell me the soln. as its not working @austere grotto

austere grotto
#

You would have to show your existing code

tranquil rune
austere grotto
#

You said "it's not working"

tranquil rune
#

yeah

austere grotto
#

So, the code for whatever "it" is

tranquil rune
#

i mean the script of my previouss code or of the new input system??

austere grotto
#

Whatever you want help with

tranquil rune
#

i want to switch between cameras but i have unity's new input system

austere grotto
tranquil rune
#
using UnityEngine;

public class CameraSwitch : MonoBehaviour
{
    public Camera normalCamera;
    public Camera sniperCamera;

    void Start()
    {
        
        normalCamera.enabled = true;
        sniperCamera.enabled = false;
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Y))
        {
            ToggleCameras();
        }
    }

    void ToggleCameras()
    {
        normalCamera.enabled = !normalCamera.enabled;
        sniperCamera.enabled = !normalCamera.enabled;
    }
}
austere grotto
#

!code

sonic sageBOT
tranquil rune
#

ik buti forgot

tranquil rune
#

pls reply

sterile citrus
# spare frigate Maybe you could setup different "Action Maps" for the different kind of input yo...

Hmm I see. But does that mean you have no interactable UI when your player controls are active? That doesn't seem viable for my use case, where I want keyboard/mouse input for gameplay but also UI elements that are interactable at the same time.

So I have a InputSystemUIInputModule in my scene, I assume this automatically enables the "UI" maps, which I figured was necessary. So I need to manually handle enabling/disabling this when I don't want UI events at all? Hmm... I could try setting this up but I'd need to do it in a way where some of my HUD buttons are still interactable...

I think where I might be getting wires crossed is that the button event comes from the UnityEngine.UI.Button.onClick callback and the pointer event comes from the InputAction.onPerformed callback. But literally every Unity game that uses UI buttons and the new InputSystem must have this same problem then.

nimble estuary
#

Good morning everyone!

Last night I was up very late, way later than is good for my day job, trying to make my thus far simple app run on a Meta Quest 2. I got it running in that its in the headset, but as I turn my head the scene didn't change, nor could I see any effect from moving hand controllers.

I worked through several video tutorials, no joy, but they all seemed to be a bit older. I'm running the current Unity, I wonder if someone could point me to a current tutorial, or perhaps some hints as to what to check? There is so much to this I don't even know where to begin looking for the issue.

spare frigate
# sterile citrus Hmm I see. But does that mean you have no interactable UI when your player contr...

In my case, I am working on a FPS so by design I prefer the player to not interact with much UI when player controls are active, though thats something you can choose, as entire ActionMaps can be toggled, or just specific Actions, they all have a .Enable() and .Disable() func - toggling that InputSystemUIInputModule could be another option as well, though I havnt personally tried it to comment on that approach, you may still be able to use IPointerHandler interfaces such as IPointerEnterHandler, IPointerClickHandler, etc, which could be a good mix for what your looking for?

There are many ways you can use the input system, using a action map is one way, you can also poll input in Update as another, I believe there are even components for handling object-specific and global inputs

sterile citrus
# spare frigate In my case, I am working on a FPS so by design I prefer the player to not intera...

Thanks for your reply! Yeah I think you're right that there are just many ways to use the input system package. Maybe too many such that it isn't obvious what the correct way is for a specific situation haha.

I've found that doing this check inside my InputAction callbacks does pretty much exactly what I want:
if (EventSystem.current.IsPointerOverGameObject()) return;
But now I get annoying log spam:

Calling IsPointerOverGameObject() from within event processing (such as from InputAction callbacks) will not work as expected; it will query UI state from the last frame
I'll just store the value in a bool in update to get rid of the warning spam, but glad it's working now.

slate mural
#

Hello,
I am developing a car game.
I want my car controls similar to Forza game for gamepad 🎮

Can someone help me with setting up input asset of new input system and script for mapping them....!?

wraith gazelle
#

how come if i spawn more than 1 player the player that was spawned last wont have the current scheme and devices connected?

austere grotto
#

If one is using kb+m the second won't

wraith gazelle
#

is there a way i could prevent that?

#

because all i really need is to just spawn in 2 players

#

with the same scheme (if possible)

austere grotto
#

Don't use PlayerInput

wraith gazelle
#

what sould i use instead?

austere grotto
#

One good option is the generated C# class from your actions asset

wraith gazelle
#

does it make a difference if the second player is online and not local?

austere grotto
#

If the second player is playing on a different computer then they don't need a control scheme at all on this computer

#

Disable/destroy or don't spawn anything related to input on such an object

next stone
#

Hi everyone, i have actually a bug with the unity Input system, i don't know if it's a bug but that's a problem.
I have a first scen with 4 canvases, all the canvases are asssigned to a gamepad, i choose a prefab of character with all the panels in the canvases with my four gamepads.
After all the players selected, the script move in a new scene were my players are instanciated, my 4 players are instanciated but i control them all with my Player 1 gamepad, what can i do to fix that ? sometimes i have just one player controlled by all the gamepads

bitter roost
#

Were you able to figure it out?

slate mural
#

No, not yet

slate mural
#

`
if (Input.GetKey(KeyCode.W))
{
CancelInvoke("DecelerateCar");
deceleratingCar = false;
GoForward();
}
if (Input.GetKey(KeyCode.S))
{
CancelInvoke("DecelerateCar");
deceleratingCar = false;
GoReverse();
}

if (Input.GetKey(KeyCode.A))
{
  TurnLeft();
}
if (Input.GetKey(KeyCode.D))
{
  TurnRight();
}
if (Input.GetKey(KeyCode.Space))
{
  CancelInvoke("DecelerateCar");
  deceleratingCar = false;
  Handbrake();
}
if (Input.GetKeyUp(KeyCode.Space))
{
  RecoverTraction();
}
if (!Input.GetKey(KeyCode.S) && !Input.GetKey(KeyCode.W))
{
  ThrottleOff();
}
if (!Input.GetKey(KeyCode.S) && !Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.Space) && !deceleratingCar)
{
  InvokeRepeating("DecelerateCar", 0f, 0.1f);
  deceleratingCar = true;
}
if (!Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D) && steeringAxis != 0f)
{
  ResetSteeringAngle();
}

`

#

Code for input

#

I need code for gamepad input like the one Forza or nfs has implemented

slate pelican
slate mural
#

The mapping of input
For eg. RT to throttle,
LT to reverse, A for handbrake etc

#

Unity inputs for xbox Gamepad mapping is difficult for me to implement.

slate pelican
#

for that, you might want to use InputSystem

slate mural
slate pelican
#

InputSystem is really good for 3 things: 1) mapping different types of controller setups, 2) Calling events based on controller inputs, and 3) capturing more advanced inputs (like tap vs hold vs cancel)

#

first, you would change the code to use the new input system. Then you’d go to the relevant InputSystem asset and add separate bindings/layouts for different types of controllers

#

i’m skipping details, but that is the gist of it

#

and you can check out tutorials to see how that works

slate mural
#

I have seen videos but I am unable to understand it

slate pelican
#

Input is for really quick-and-dirty input detection. Fast to code, but very few features, and few opportunities to improve

#

do you understand delegates?

slate mural
#

Yeah I have worked with them

slate pelican
#

ok, InputSystem invokes delegates what different sorts of inputs are called

#

the delegates spit out an object of type CallbackContext

#

CallbackContext gives information like what sort of interaction (tap vs hold etc) and phase (started, canceled, performed)

#

you subscribe a method to a delegate of your input system. InputSystem invokes if input happens, then the method goes off

#

understand?

slate mural
#

Yeahh I understood

#

Just a small doubt

slate pelican
#

this is a lot better than having everything that needs to check for the A button checking every single frame “if pressed A OR pressed A equivalent on XBox OR pressed X on PS5 OR…”

#

the inputaction asset allows you to define bindings

#

so you can make a given input be called “Jump”, and this is invoked by spacebar (on keyboard), X on PS5, A on XBox…

#

that is done in the menu of the InputActionAsset

slate mural
slate pelican
#

yes, but you don’t want to do that if you use InputSystem

slate mural
#

Ohh okk

slate pelican
#

you want to subscribe delegates

#

then if you want to make commands cancel each other (like brake button cancels acceleration button), then you want to use a command pattern

slate mural
#

Ohh okk

slate pelican
#

command pattern is like: when the button is pressed, you store an object that says to do something. When ready, you sift through and decide which of those actions to do

#

and you might even simplify with an enum.

slate mural
#

Ohh I get it

slate pelican
#

enum CurrentAction { Neutral, Braking, Accellerating} (as enum flag)

slate mural
#

👍.

slate pelican
#

gl

slate mural
#

I will try to implement accordingly

slate pelican
#

for turning, I would use the .ReadValue method

#

.ReadValue gets the current value of a given controller input.

#

and I would ReadValue for control stick because you want to read it every frame. Not just on frames where you actually press something.

#

i would NOT ReadValue for buttons, because part of the benefit is saving time because you ONLY call the function for braking when the brake is pressed, for example

#

those should be subscriptions

slate mural
#

Ohh okk 👍

fresh bramble
#

I'm getting some really weird behaviour on Linux. (Unity 2022.3.14f1 on Linux Mint 21.2)

What I want to do: Right clicking locks the mouse and lets the player rotate the camera. When the button is released, the mouse gets unlocked and is positioned in the same place as before. The following code works perfectly fine for this on Windows.

private Vector2 pos;

public void Lock()
{
    pos = Mouse.current.position.ReadValue();
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

public void Unlock()
{
    Cursor.lockState = CursorLockMode.None;
    Cursor.visible = true;
    Mouse.current.WarpCursorPosition(pos);
}

However it behaves weird on Linux.

  1. WarpCursorPosition doesn't position the cursor on the correct position when playing in the editor. In the build it works fine.
  2. When getting mouse movement from the old Input system (Input.GetAxis("Mouse X")), the values are smaller when the cursor is locked.
  3. When getting mouse movement from the new Input system (Mouse.current.delta), the value sometimes "snaps back" when the cursor is locked. This only happens when the mouse is moved in a negative direction. So I move to the left and get -5x or something and on the next frame I get a positive value, as if the fixating the mouse back to the center counts towards the delta...
solid forum
#

How do I get the names for the 2d vector keys?

#

like I am getting normal button presses like this

#

I'm just not too sure how to get them from a 2d vector

austere grotto
solid forum
#

its apparently the same type as a regular button so im not too sure

austere grotto
#

try it and see

solid forum
#

ah wait I see what you mean

solid forum
#

huh strange

#

maybe theres a different way I should be grabbing them instead of indexing the array

#

input system is confusing lmao

timid dagger
# solid forum huh strange

I think you need to get the index of composite, and then iterate from it until you encounter something that is not a part of composite. Lemme check it.

solid forum
#

idk I was hoping it was gonna have its like

#

own type but I think I remember running into this same issue a while back its just strange

#

it should be fine for now

#

if I just index if from the array with those numbers

#

but like obviously if theres a much better way I'd love to implement that

timid dagger
solid forum
#

Am I also able have an editor reference to an action or is it just only to make a script only one

#

ah I found it

#

its quite literally called InputActionReference

timid dagger
#

@solid forum

[SerializeField] InputActionReference actionReference;

void Start()
{
  Debug.Log (actionReference.action.GetBindingDisplayString());
  foreach (var binding in actionReference.action.bindings)
  {
    Debug.Log($"{binding.name} {binding.isComposite} {binding.isPartOfComposite}");
  }
#

I don't see any references between composite and parts of composite, so I guess you will have to iterate.

solid forum
#

thats alright

timid dagger
#

I kinda hate how GetBindingDisplayString() displays keys in a different order than I configured it. 😠

solid forum
#

thats unity for you lmao

solid forum
#

Now I can't seem to get the rebinding to work

#

actually before I continue im gonna make sure its the right reference

#

but yea I'm not sure because even if I like hard code it to be control (just as a testing key) it doesnt override any of my binds

solid forum
#

yea strange it runs it but it doesnt do anything

#

maybe the index is wrong?

#

actually yea I believe so wtf

solid forum
#

Does anybody know how the docs are indexing with actions

#

I'm assuming thats just like

#

all of this

#

actually huh something as direct as this isn't working

#

ah its probably the way im using input system

#

its probably because this project is creating a new Input everytime it needs to use controls

#

which probably isnt what I wanna do

#

I prolly wanna use only one and use that

solid forum
#

since I started this project back in like late 2021

austere grotto
solid forum
#

yea thats what im gonna do since I didnt see a problem creating a new one each time until now

austere grotto
#

Yep if you need shared state such as enabled/disabled actions or rebinds, that's tried to the instance

solid forum
#

haha yea drove myself crazy for an hour, at least its better practice to do it this way

solid forum
solid forum
#

im mistaken PlayerInput is its own class

solid forum
#

Alright I think im back on track, I haven't finished this but I started using PlayerInput as previously I was using just the raw input

wraith gazelle
#

why doesnt user #1 have any paired devices?

austere grotto
wraith gazelle
#

Same ones as user 0, a keyboard and a mouse

#

Do I have to set them manually?

austere grotto
wraith gazelle
#

my current issue is:

#

i have a build and the editor that im using to test. whichever is the "host" has a control scheme and paired devices whilst the player that joins through localhost doesnt

#

i even tried it on another computer and the issue persists

#

whichever is the host has working controls and the second player doesnt

austere grotto
#

That doesn't make any sense. You shouldn't have two input users if it's a networked game

#

Multiple input users is only a thing for local multiplayer

austere grotto
#

Oh I guess you're running both clients on one PC for testing, yes?

wraith gazelle
#

yes

austere grotto
#

That's not exactly a realistic scenario

wraith gazelle
#

i can try having one running on this pc and another one on a different pc

austere grotto
#

Anyway just destroy/disable any input handling objects or components for all players except the local player

wraith gazelle
#

but last time i tried that it still didnt work

#

but lets say i do want 2 objects/players to be controlled locally on the same pc

#

do i make 2 separate schemes, separate binds for each or ??

austere grotto
#

Yea

#

Or just one scheme and multiple devices that satisfy it

#

For example a gamepad scheme can be reused by any number of plugged in gamepads

wraith gazelle
#

yeah, gamepads i get

#

but what would i do if i want one to use wasd and the other use arrows?

austere grotto
wraith gazelle
#

oh this one looks perfect

#

tysm!

wraith gazelle
#

same thing

austere grotto
wraith gazelle
#

but wont that break inputs for the other player?

wraith gazelle
austere grotto
#

Two ways. Either have it on the prefab to start and if (!IsMine) Destroy(whateverHandlesInput); or don't have it on the prefab in the first place and if (IsMine) Instantiate(whateverHandlesInput);

wraith gazelle
#

ahhhhhh

#

yeah, the latter sounds good

#

tysm!

fallow wadi
#

Do you know why my project is now In QWERTY ? it's a bit strange but I have a AZERTY keyboard so I put my mouvement input to ZQSD but now it work only withs the input WASD like if my keyboard was In english, but he is still in french, I can still write normaly in the unity editor with my french keyboard but when I lunch the game it's like if I play with a English keyboard

wraith gazelle
wraith gazelle
austere grotto
#

Are you using PlayerInput?

#

In send message mode?

wraith gazelle
#

yes to both

#

both look like this

fallow wadi
wraith gazelle
#

and the player input is only on the local player

austere grotto
#

Make sure at runtime that all looks good and is enabled etc

wraith gazelle
wraith gazelle
#

first player

#

i put some prints to see if the mssages are being sent, and theyre not

fallow wadi
ancient trout
#

Unrelated to coding but how do I fix this, the UI for the InputActionAsset is not showing properly

odd shadow
#

bruh what

#

"Instance Assigned"

"No instance"

austere grotto
spare frigate
# ancient trout Unrelated to coding but how do I fix this, the UI for the InputActionAsset is no...

I have the same issue, tried every Input System package version from 1.0.0 to latest 1.7.1, and many Unity versions from 2020.3.x to latest 2023.1.x, and sadly, it seems specific to the version of Unity - for me, when it happens I get a warning saying Unable to find style 'ToolbarSeachTextField' in skin 'DarkSkin' Used (which apparently dark or light skin doesnt matter, same error happens in both, also tested with resetting layouts) followed by an image similar to yours, after playing around with the Package Manager and different LTS versions, it seems like 2020.3.x works fine, and every version after that does not, regardless of the Input System package version your using

From what I can find online, the general consensus seems to be "the bug reporter says its fixed but its not actually fixed for some versions", it seems Unity must have mistyped a style in newer versions, this post seems to have a solution that may or may not work: https://forum.unity.com/threads/unable-to-use-input-system-panel.1450204/#post-9088999 , alternatively, you may have to downgrade to 2020.3.x from my testing so far if the link doesnt help (you may get package errors when doing this, and potentially other errors if your using a render pipeline or features that are version-dependent)

With your project closed, the fix mentioned in the post:

  • navigate to the cache directory (C:\Users\{user}\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.inputsystem@{version}\InputSystem\Editor\Internal\AdvancedDropdown\AdvancedDropdownGUI.cs)
  • edit line 16 public static readonly GUIStyle toolbarSearchField = "ToolbarSeachTextField"; add a "r" to the word "ToolbarSearchTextField"
  • delete your projects Library folder
  • relaunch your project (your last opened scene may reset to default)
  • open a input action asset window (if one is already open, close and re-open it)
    If neither seemed to help, hopefully someone else could provide more insight and alternatives
young vortex
#

I have a DualShock 4 controller connected to my PC via bluetooth which is recognized/working fine in Unity, but the UnityEngine.InputSystem.PlayerInput.onControlsChanged event is constantly switching between a (non existent) xinput device and the dualshock device whenever I do any action on the dualshock device. Any idea why this might be happening?

quasi spindle
#

so i'm using a dual shock 3 controller connected through the necessary means (and i tested with both steam and roblox to see if controller works on all joystick inputs and it does) and I noticed with Unity that it registers my left stick for left and right input and right stick for up and down input. Is there a way to have it all set to the left stick?

magic drum
#

What are triggers called in the Input Manager?

#

gamepad triggers*

quasi spindle
#

left stick/gamepad and leftstick/dualshock

#

that said unsure of weird quirk but it can't seem to read the input of the left stick when i move it up and down

#

only when i move it left and right

#

what's even weirder is that on the classic input manager it can read all four axes

#

from the left stick

quasi spindle
magic drum
#

Yup

#

I can't seem to figure out how to add them to my input manager.

#

hard to tell which gamepad button maps to which axis.

#

28 joystick axis later. none of them are connected to the triggers.

quasi spindle
#

has anyone attempted to map a DS3 (DualShock 3, PS3) controller to unity?

#

just ask cause on specificity, for some reason left and right on the left stick are mapped to the up and down on the right stick and i'm a bit confused why.

I wouldn't mind if I was given a way to manually recalibrate the controller on the engine because i know it's not a hardware issue when i tested my controller on a few games on steam and roblox as well as an online controller input tester.

hazy jetty
#

Not sure if this is the right spot for it but I'm having issues scrolling with the Scroll Rect, everything looks okay according to a tutorial I was following.

#

If I click and drag outside of the buttons up or down, nothing happens

#

Elastic works sort of but it's like a rubber band.

hazy jetty
#

ty

quasi spindle
#

i should also preface i use DS4 windows and DSHIDMini to allow my PS3 controller to run on my laptop

#

and on DSHIDMini is where i set the controller's HID device mode

storm marlin
#

Has anyone tried to localize keyboard input? There's very little to be found when I google it seems, or I'm just not hitting the right terms

steady pivot
#

I'm using the input system to rotate an object while I hold a direction, but while I'm holding a direction, it causes the object to very quickly switch between the correct direction and the exact opposite of that direction, and the direction it ends on is one of those, seemingly randomly

glass yacht
#

Don't use the constructor, use the helper methods like AngleAxis

steady pivot
#

I tried, but now it isn't rotating at all

#

This ain't doing anything either

glass yacht
#

The bottom code is doing nothing

#

Hence why it's all greyed out

#

The top code, the values are probably just not scaled enough, have you tried debugging it to see what angle is?

steady pivot
#

Bingo, that was it. Thank you

silk dove
silk dove
#

Thanks!

quasi spindle
#

question is there a way with the new input system to unify a group of actions in a function?

#

i plan on having four actions that use the same modifier but use a different face button

#

and all four of them basically are selecting a skill from an array of 4 skills

#

so is there a way i can cram the 4 action functions into one so i don't just have each one call the same function but with an index value?

austere grotto
quasi spindle
#

gotcha

glass tangle
#

Hi

#

How can I make a positioning system for a racing game with a pass on the number of laps each vehicle has completed in Unity?

viral flicker
#

How can i make a coop setup screen using the player input manager?

glass tangle
#

I so sorry

quasi spindle
#

question. Tried doing a button with modifier combo for the skills (basically had square button for normal attack but L1+Square for skill attack) but it seems as though both of them are called at the same time. Is there a way to fix it so that if the modifier button is pressed it ignores the action variant without the modifier? (like if i press L1 + Square it should not play the action bound to only square)

quasi spindle
young vortex
#

Why am I getting DualShock AND XInput device input when using DualShock input devices?

#

It's creating conflicting bindings in the new input system

#

It seems like currently the only options are to restrict controls to keyboard&mouse/generic gamepad, or don't use the new input system at all

#

because you can't differentiate between PlayStation/Xbox controllers, since PlayStation controllers keep invoking XInput(Xbox) controls as well...

#

And no Steam is not running, and I don't have DS4Windows, I tried google already

#

Xbox controllers work fine, DS controllers register both Xinput & DualShock input device

#

the input system documentation explicitly states it supports DS4 controllers, so why is it duplicating all inputs as an XInput device as well?

#

does it natively support DS4 controllers or is it emulating it through an XInput device

viral flicker
#

im using this thing to spawn players in

glass lark
#

What would be the best way to go about just detecting a general mouse click/screen tap.

I don't need to detect the tapping on any specific object, as it's simply to progress dialogue.

verbal remnant
lone python
#

Hi, I created a virtual cursor that I can use with a controller except that the problem is that it no longer detects the interface if I launch the game with a resolution other than 1920x1080
With another resolution the cursor (the green square) detects the button even though it is not positioned on it
Does anyone have a solution please?

austere grotto
lone python
#

In my canvas i created an image for the cursor, i put his anchor in left bottom, and then i added the script Virtual Mouse. My canvas is scaled with screen size 1920x1080

timber oriole
#

Why am I getting DualShock AND

half geyser
#

Hey, I'm a bit new to the new input system and I'm trying to get each player assigned a controller.

Right now I have 2 controllers plugged in and both players respond to both controllers.

In my player input script I created a PlayerID that gets assigned in the inspector and based on the player ID it will use the actions 1 or 2 depending on the player number. This helped me with sperating keyboard input from gamepad, but not gamepad from gamepad

austere grotto
half geyser
#

Every tutorial I see just has the player created when the button is pressed and they are assigned different controllers.

But when I do it they are assigned the same controller

#

It must be my script that is wrong

#

I was trying to use the Player Input Manager, but it just wasn't working

austere grotto
half geyser
#

ohhhh I'm not supposed to use that??? lol
I was under the impression that I had to use the c# class

#

Thank you for the advice

austere grotto
thin musk
#

Hey, how can I use UI input system with multiple game objects containing buttons?
Basically I have a state machine, if I choose an option to switch to a different UI object, what do I do to enable those buttons for the Input system?

#

Do I just Button.Select() whenever I want to "focus" new UI element?

blazing loom
#

Hi, I'm struggling with something in VR. Unity version 2021.3.9.
I added a Rigidbody and an XR Simple Interactable as components to an object.
I then added a trigger function/method for some in-game menu to the On Select Entered of the XR Simple Interactable.
This works well enough: the way I do it in-game, I'm coming up to the object, intersect it with one of my hand models, then press grab, and the menu pops up fine.

The issue arises afterwards: once the menu is closed, I notice I can go wander wherever else in the scene and it turns out pressing grab again on the SAME controller I originally used to bring up the menu… brings it up again.
If I go back to the object and do it with the other hand, now both hands have “gained” the right to trigger the interaction remotely, if you will.
How can I fix that? I'd want to always only be able to trigger the menu by properly interacting from up close. It works fine at first, but once used, my hands seemingly obtain magical superpowers, and I don't want that~

#

Essentially, this is the opposite issue to your usual “SimpleInteractable doesn't work with direct interactions AAAAAA” ramble. In my case, it actually interacts too good and I'd like it to stop thinking it's interacting at a distance when it's really not anymore.
Don't hesitate to ping me, by the way, if anyone can help! ^^

austere grotto
blazing loom
blazing loom
#

OKAY got it! My code indeed could've helped, though it alone wasn't enough to view the issue: I configured it to disable the hands, so they thought they were still interesting the object.

topaz hill
#

Trying to rebind an xbox controller. The rebind command is not detecting it. It detects keyboard input just fine. All other functionality of the gamepad works (movement, etc...).

#

playerInputActions.Player.Disable();

InputAction inputAction = playerInputActions.Player.Interact;
int bindingIndex = 1;

if (inputAction != null)
{
inputAction.PerformInteractiveRebinding(bindingIndex).OnComplete(callback =>
{
Debug.Log("Binding complete!");
callback.Dispose();
playerInputActions.Player.Enable();
onRebind?.Invoke();

    PlayerPrefs.SetString(PLAYER_PREFS_INPUT_BINDINGS, playerInputActions.SaveBindingOverridesAsJson());
    PlayerPrefs.Save();
}).OnCancel(callback =>
{
    Debug.Log("Binding cancelled!");
    callback.Dispose();
    playerInputActions.Player.Enable();
    onRebind?.Invoke();
})
.WithControlsExcluding("Mouse")
//.OnMatchWaitForAnother(0.1f)
.WithCancelingThrough("<Keyboard>/escape")
//.WithBindingGroup("Gamepad").Start();
.Start();

}

copper dust
#

Hey guys i'm having trouble with the new input system and the Camera.ScreenPointToRay function

#
private void OnAimingTarget(InputValue value)
{
    Vector2 rawInput = value.Get<Vector2>();
    
    Ray ray = _mainCam.ScreenPointToRay(rawInput);
    _plane.Raycast(ray, out float enter);
    Vector3 target = ray.GetPoint(enter);
    Vector3 aimingDirection = target - transform.position;
    aimingDirection.y = 0;
    AimingDirection = aimingDirection;
}
#

after this method is called aimingdirecion has some weird value

austere grotto
copper dust
#

to the mouse position

austere grotto
#

Also what is the "weird value" and how does it differ from what you expect

copper dust
#

it is kind of off-centered i guess

austere grotto
#

Wdym

copper dust
#

if i try the ScreenToViewPortPoint function for example and try going with the cursor on the bottom left and on the top right i get respectively (0, 0) as expected and something around (3.8, 2.1) which is really weird

#

shouldn't i get (0, 0) and (1, 1)?

austere grotto
#

Do note that since you're doing this in OnAimingTarget it's only going to update when you move the mouse.

What you really need to do is just have this code update the raw input variable but then do all the rest of the code in Update

austere grotto
copper dust
#

yeah that shouldn't be a problem because i'm just rotating the character with AimingDirection

copper dust
austere grotto
copper dust
#

i wasn't using the right cam

#

thank you 🤦‍♂️

shy patrol
#

is rewired still necessary ? I heard they changed the input since since unity5/2018 and I initially bought rewired because of that. So now that they changed it what is the main point of using it now ?

tulip tartan
#

The "new" input system is pretty great though. I suggest trying it out and seeing what you like best

austere grotto
thin musk
#

Looking for a tutorial on new input system, mainly focused on UI and how to write good for more complex UI instead of 3 buttons examples I see everywhere.
Paid tutorials are fine if not crazy expensive 😄