#🖱️┃input-system

1 messages · Page 57 of 1

lost mirage
#

Huh weird... so I added an InputActionMap via code to an existing Input asset , and I have ondestroy to remove the same map, but I'm getting this error:
InvalidOperationException: An action map called 'TilesSelectorEditorTool' already exists in the asset

initialization:

      if(ExtraBindings is not null && ExtraBindings.Any()) {
        WorldEditor.Controls.actions.AddActionMap(ExtraBindings);
        ExtraBindings.Enable();
      } ```

OnDestroy:
  if(ExtraBindings is not null && ExtraBindings.Any()) {
    ExtraBindings.Disable();
    WorldEditor.Controls.actions.RemoveActionMap(ExtraBindings);
  }```

ExtraBindings is just an InputActionMap

#

I also can't see the map it's saying exists already in the actual asset itself in the editor:

#

Huh... So I restarted unity and see it now, but it looks like my save button's not working anymore

final geode
#

built tools to let me easily set up more of these

opal flare
#

Hello !

#

does anyone know how to use you joycon for unity ?

#

liek i have a project and i would like to try to make it work with joycons too

#

anyone knowing how to do this?

ember pollen
dreamy swift
#

how do you get your mouse x and y axes with active input handling?

austere grotto
#

New system or old system? "Active input handling" is just the project setting that lets you choose between the new and old system

dreamy swift
#

sry I didn't see your message, new system

austere grotto
#

You can bind an input action to Mouse/Delta

dreamy swift
#

ok and should that be an 1D axis or a 2D vector?

austere grotto
#

2D of course

#

You have two dimensions - x and y

dreamy swift
#

ok thx

dreamy swift
#

if you or anyone else is still there, is this right?

austere grotto
#

don't use a vector2 composite

#

just use a normal binding

#

and bind mouse/delta to it

dreamy swift
#

oh ok

#

should that be a button, value or pass through?

austere grotto
#

value/vector2

dreamy swift
#

alright ty, I should be able to figure it out now, but I'll send a message if there's anything else

mossy roost
#

Hey there!
Can someone please tell me how to change "Scale Vector 2" under "Processors" in game?
Thanks in advance!

dusk portal
#

Hello, is there a way to detect if a keyboard is available for input ? (using the old inputsystem)

steep ridge
#

How can I get all information of a Touch there is zur Control Type Touch but I can not geht its information aus I dont't know what type ist returns any Ideas ?

#

*it

steep ridge
#

There is a Control Type

#

Sorry autocorrect 😅

dusk portal
#

Not sure to understand but maybe this what you are looking for:

#

Input.touchSupported, Input.touchCount, foreach (Touch touch in Input.touches)

steep ridge
# foggy notch Use enhancedtouch

Ah thanks I will Take a Look but Ther is a Control Type called Toch so I was wondering If can't Just geht The Primary Toch and then ger all teh information

foggy notch
steep ridge
foggy notch
steep ridge
#

So how would I get the Information ?

foggy notch
#

var activeTouches = UnityEngine.InputSystem.EnhancedTouch.Touch.activeTouches

steep ridge
#

Thanks

spare frigate
#

Is it possible to rebind a input binding using a gamepad/controller? I can for example, rebind my "Jump" action to space or some other key with my keyboard, but could I rebind it to lets say "South" with my controller? (being X on PS4 and A on Xbox)

foggy notch
#

Yes

spare frigate
# foggy notch Yes

How would I go about it? Do I specifically have to listen for Gamepad.current myself, or is there already a built-in way like with rebinding? Using RebindingOperation op = someAction.PerformInteractiveRebinding(0).Start() only cares about keyboard input, absolutely nothing happens when I try to give it controller input during a rebind, is there another function for controllers?

foggy notch
#

If you want different presets like Default, Tactical, Southpaw you could just have InputActions presets

#

I’d have to look up how to listen to input with a game pad but you could definitely do it with a drop down menu

spare frigate
# foggy notch There’s honestly a lot of ways to do it and it really just depends on what you’r...

Im basically trying to setup a rebinding system at runtime so players can choose to change for example "Jump" to whatever key they want, regardless if they are using a controller to play the game or a mouse and keyboard - I have it setup already that my character controller will recognize if theres any input from the controller switch the scheme to the controller scheme, otherwise use the keyboard one, so far the only idea I have is to setup a Update function somewhere and just check every single button and axis for controller input and if there is any on a specific one, return it and basically do the listening myself, but that wouldnt go through RebndingOperation at all

foggy notch
spare frigate
#

Ah alright, I guess theres no convenient built-in way, I guess it could create my own listener for controllers specifically then, or try a dropdown like you suggested and do the rebinding by a switch statement or something - thanks

gleaming oar
#

I'd create separate input actions, one for controller and one for mouse/keyboard that accomplish the same tasks, with separate functions for each one's .performed. OR create 2 different InputActionReference's and subscribe all the functions once--then at runtime swap the InputActionReference variables whenever the input type is switched

#

Since InputActionReference abstracts away the action to just whatever the action is. It could be anything as long as the context.action.ReadValue is of the correct type

spare frigate
#

Hmm, even making multiple .performed functions would still leave me with an issue of actually accepting controller input as the rebind request for specific actions, so I ended up going with a bit of a tedious approach, maybe theres a better way, but I basically just made a enum for each button/axis/trigger on the controller, and setup Gamepad.current in a Update to check for every single controller input, then made the "lastAction" as a public static enum, this way in my rebinding script when I start "listening for a key to rebind to", I can check if the lastAction != ControllerInputNames.None then get the path for that specific button/axis/etc - seems to work fine so far, and the same rebinding script has a check if there is a gamepad and its active then use this new GamepadListener, otherwise use the built-in RebindOperator for keyboard listening

jagged wyvern
#

Didn't unity already provide that functionality in their samples?

gleaming oar
#

as long as it's event based it should be good

sick stratus
#

Is there an issue with the Input System? In 2021.2.2f1, my input is only working when the game window is not focused. If it is focused, no input is read.

sick stratus
#

Weird. Seems that I cannot directly ReadValue<Vector2> as a return type, but I have to assign the ReadValue to a defined vector2 first, and then read from that vector2

austere grotto
#

That seems... untrue

stable coral
#

So I'm having issues I'm not really understanding. So I'm working on local multi and If I have "Joining by default enabled" enabled then only the first player who connects can use the ui. But if nobody joins then both can use it, as i want to

#

is there a way to make players join but also be able for both of them to use the ui?

stable coral
#

wait... i fixed it somehow lmao

hallow solstice
#

Anyway, how can I get the new input system equivalent of mouseX and mouseY?

#

The ones that get movement rather than position

lone blade
#

Hello everybody, I am having a bit of trouble implementing user controls with the new input system. I have added the Input events called "ShowDebugWindow" and "Return", aswell as adding a 'Player Input' component to my player but when I press these buttons, nothing happens. and Rider says that these methods "are never used". What am I doing wrong here?

crisp gyro
#

where are those methods being called from

lone blade
#

what do you mean?

jagged wyvern
#

with the player input component?

lone blade
jagged wyvern
#

make OnReturn to onReturn

lone blade
jagged wyvern
#

is the script on the same game object?

lone blade
#

no?

#

oh

#

waot... are they supposed to be on the same go?

jagged wyvern
#

yes

lone blade
#

hang on

jagged wyvern
#

that's how sendmessages works

lone blade
#

I must be doing something else wrong?

jagged wyvern
#

change back to OnReturn that was my bad

lone blade
#

It's still not working? Even rider says the method is never used?

jagged wyvern
#

When will showconsole be true

lone blade
#

I'm doing a flip flop so, whats supposed to happen is if the user presses the ` key, it would turn the console on and off

#

but the OnToggleDebugConsole input also does not work

#

I know the OnToggleDebugConsole input also doesn't work because that debug.log doesn't... log

#

i am really bloody puzzled

jagged wyvern
#

should work idk what to tell u

#

alternatively using unity events works too

lone blade
#

hmm

#

could it be a setting problem?

jagged wyvern
#

idk

lone blade
#

hmmm right okay

crisp gyro
#

whenever any binding for an action if fired, it triggers an event

#

where in your code are you calling the methods you want when those events are triggered]

jagged wyvern
crisp gyro
#

@jagged wyvernyou mean you can also read the value of an action?

#

the problem is that I don't see any way that upsilon is connecting those actions to the methods he wants called

#

in any way

jagged wyvern
#

with the player input component

#

I've used that way before

#

it works but i don't know why his doesn't

crisp gyro
#

and how do you get values from the player input component?

jagged wyvern
#

with send messages

crisp gyro
#

wait

#

so aren't his methods supposed to have the same exact name as the actions?

jagged wyvern
#

no

#

read the documentation

lone blade
#

I think its On[actionName]

lone blade
#

i have even tried reinstalling the package and recreating the input action set

jagged wyvern
#

did it work

crisp gyro
crisp gyro
#

Does it work if you try using the events?

#

or action.performed?

lone blade
#

its like my IDE is recognising these as a standdard method definition instead of using a prexisting method

lone blade
crisp gyro
#
    public PlayerInput _playerInput;
...
    void Update(){
        if (_playerInput.actions["Drop"].triggered)
            {
                shootScript.DropWeapon();
            }
    }
lone blade
#

WAIT

#

I did it!

crisp gyro
#

how?

lone blade
#

awhh god, sorry guys

jagged wyvern
#

🤷‍♂️

lone blade
#

I'm so bloody sorry

crisp gyro
#

well, this taught me that SendMessage() exists

lone blade
#

But thank you two for helping, the new input system seems hard to understand but seems like it would be beneficial learning

crisp gyro
#

the NIS has a learning curve that the old one didn't have

lone blade
#

oh yeah defiently

glass yacht
#

The old one had it's own curves, but you didn't have to face them immediately. Just implementing controllers without something like Rewired was nasty. I think the new one could go a long way if they helped indicate problems with state or setup like this

#

The inspector could have an indicator to show the active scheme is different for example

crisp gyro
#

I find it a bit overwhelming that there's at least 3 ways of doing the exact same thing

#

you just have to commit to unity messages, events, or polling

glass yacht
#

Agreed, it would be much nicer if the docs were better laid out to explain that too

jagged wyvern
#

docs are a mess

#

no nice way to say it

glass yacht
#

it feels like the top pages on the docs are just lists of migration you would never want to do

#

instead of just explaining the basics you have a list of garbage ways to use it

crisp gyro
#

that reminds me that a lot of the early tutorials went outdated within several months once the NIS got updated to 1.02

jagged wyvern
#

can't wait for the new new input system

vestal crane
#

When i try to type "using UnityEngine.InputManager;" in vs code, it puts a red bar under it and doesn't allow the program to run. I'm using the input system package, and have tried every fix i've seen online, including downgrading unity's vsc package and resetting csproj files, but nothing works. Does anyone know a fix?

glad roost
#

does anyone know how to add inputs for XR?
I tried finding a unity tutorial, but all I have found use the old Input system...
for instance my code would be like:
public void MenuSelectOverHands()
{
Debug.Log("Trigger on Oculus Pressed");
}

austere grotto
vestal crane
#

Oh yea sorry that's what I meant

#

Nothing at all comes up when I type "input" tho

austere grotto
#

What are you expecting to come up when you type that?

vestal crane
#

Ok I'll just link the tutorial I was following

#

Give me a min to find it

#

this is what it looks like for me

austere grotto
#

And what's the error say?

vestal crane
#

Unnecessary using directive. [Assembly-CSharp]csharp(CS8019)
The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) [Assembly-CSharp]csharp(CS0234)

austere grotto
#

Either

  1. You haven't installed the input system package or
  2. More likely, just an issue with VSCode syncing properly with Unity
#

If unity doesn't show that error too it's just a VSCode problem

#

Regenerate project files is the usual solution

#

But VSCode is known to be finicky

vestal crane
#

Yea it didnt do anything

austere grotto
#

Try checking some more of the boxes

vestal crane
#

Theyre all checked

austere grotto
#

Like local packages etc

#

Does unity show the error or not

vestal crane
#

it says that the compiler had an error so it cant run

austere grotto
#

What error

#

Look in your console window

vestal crane
#

same as in vsc. The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

austere grotto
#

Seems like the package isn't installed

vestal crane
#

Its absolotely installed lol

austere grotto
#

Show your package manager

vestal crane
austere grotto
#

So you've just spelled it wrong

#

Make sure you save the file

vestal crane
#

ok im an idiot but that still doesnt explain why vsc thinks its wrong

#

it does at least run

austere grotto
#

Because vsc is crappy lol

#

IDK

vestal crane
#

and 90 minutes later while not changing it at all, it suddenly thinks its fine now

#

ill take it

remote mantle
#

Player Controls Script: https://gdl.space/huluyepida.cs
Issue: Whenever I press the up arrow key while pressing the left or right arrow keys, the movement stops
Note: I am using invoke unity events

waxen mica
#

Hey, can someone help me figure out how to trigger events through toggle

olive osprey
#

I somehow cannot acces UnityEngine.InputSystem in C# script,anyone knows why ?

olive osprey
#

yes

#

i have set it up in projects setting as well

foggy notch
olive osprey
#

yes

hallow solstice
#

Can i get a bool from an inputaction to use it like GetButtonDown?

foggy notch
#

Show what your project settings say in the input section

olive osprey
#

you mean the Active Input Handling ?

#

its on Both, but i've tried it with the new one only as well

#

i tried reinstaling the New Input System and setting it to New Input System in the Active Input Handling and it worked. thx

marsh harness
#

old reply but, what code? xD

sullen kelp
remote mantle
remote mantle
torpid shard
#

Why can I only press one key at once

#

actually I know why, just dont know the fix

remote mantle
# torpid shard

for the 0s, substitute them to rb2D.velocity.y and rb2D.velocity.x

ebon merlin
torpid shard
#

ah

wispy birch
#

im working with @torpid shard, and for some reason, i cant move with wasd

ebon merlin
remote mantle
random shale
#

Hey, hope everyone's well. I'm working on a local multiplayer tennis game where I'd like Player 1 to be able to control their character with WASD + Space or a controller, and Player 2 to be able to control their character with Arrow Keys + Ctrl. Currently I have a single action map (gameplay) with two actions (movement + swing) and two control schemes (Player 1 and Player 2), each with two devices (Keyboard and Gamepad).
Issue is, when I spawn in my PlayerInput object when a controller/part of the keyboard connects it's automatically set to only use the P1 (first) control scheme. Any way for this to happen automatically? Is this the wrong way to go about something like this? Would love to know y'all's thoughts :)

candid bramble
#

my solution was to just

#

completely disable those for the other players

random shale
#

they both have different player input objects

candid bramble
#

try disabling each other's input objects. this may sound weird but it was also a problem on my game and disabling it fixed it for me

random shale
#

isn't that counter-productive?

#

I'm trying to get two separate players to use two separate control schemes

#

disabling them will mean I'll have zero players using zero control schemes

candid bramble
#

I don't know what is the most efficient way to solve this,
my solution was to just get the other player's object and disable the input manager on it.
it may be a dumb move and there is always a better way, but it worked for me

random shale
#

ah

#

thank you for your thoughts lmao

#

would like to know if there's a better way though if anyone would like to add ^^^

remote mantle
#

Player Controls Script: https://gdl.space/ijihanawot.cs
Issue: The left and right arrow keys work but the up arrow code does not work
Settings of Player Input is Down Below:

zenith carbon
#

hello, i have happened upon a bug and i was hoping that one of you have some fix to it. Player Input stops working on my non player objects (Currently just my ui), when editor starts, or after a build (build is also affected). Event system works fine. only removing it from the object and adding it anew fixes it. a copy of the object works as intended too. So far the only work around i could do is to have the player object send a message to the ui that a button has been pressed. I read forum posts from years ago with the same problem so i don't think waiting for a bug fix is viable.

Edit: seems like it is a switch of Player Input problem. apparently i haven't happened upon any discussion of that while learning how make games, nor in my googling.

remote mantle
real crystal
#

hi, tried to look it up but not found anything concrete, I'm wanting to read the value of a 1D composition from a CallbackContext

#

so for example, it's context.ReadValue<Vector2>() for a Vector2, I'm looking for the 1D equiv

real crystal
#

Got it, the answer is context.ReadValue<float>();

torpid shard
#

Can I detect for a double click?
With input system

#

For example I want to dash left when d is double clicked

sudden lagoon
#

So is there any other workaround about WebGL and input system bug (https://forum.unity.com/threads/new-input-system-not-working-in-webgl-builds.870421/)

As it still persistent if player object is added later, and not on start. It works correctly if it is spawned together with scene, but if it is spawned after (multiplayer or any spawning code), it will have this problem.

I thought moving code and input manager to Global object, but it becomes counter intuitive with multiple players.

viral nymph
#

I am confused by this new input system. If I have two gameobjects that want to listen for clicks, do I have to put the Player Input component on them both? Is it better to make a middle-man?

austere grotto
glass copper
#

im not very familliar with unity, whats wrong with the old input system?

austere grotto
#

It's just not very flexible, has no runtime rebinding support, no event driven option, no local multiplayer support, and so on

glass copper
austere grotto
#

It will sorta but you do it all manually

glass copper
#

my game only has 2 players so that doesnt seem too bad

austere grotto
#

If you're a beginner you will probably have a somewhat easier time with the old system

glass copper
#

the thing i struggle with atm is making an automatic camera using kinematiccharactercontroller but thats to be discussed elsewhere

quasi isle
#

struggling to get key presses to work properly, since i got all my logic for everything split up in states
from my understanding i have to subscribe to the key input with a function but i want that function to be in one of my state classes rather than in the player where the inputaction object is stored
This is what I have currently, which doesn't seem to work

//In PlayerController

        public PlayerControls Controls { get; set; }

        public Action<InputAction.CallbackContext> DoDodge { get; set; }

        private void OnEnable()
        {
            Controls.Player.Dodge.performed += DoDodge;
            Controls.Player.Dodge.Enable();
        }
        
        private void Awake()
        {

            DoDodge = _ => { }; //Doing this so no NullReferenceException
        }
//In PlayerMovingState
        public override void EnterState(PlayerStateManager manager)
        {
            manager.Player.DoDodge = Dodge; //This doesn't seem to work
        }

        private void Dodge(InputAction.CallbackContext context)
        {
            Debug.Log("Dodging...");
            manager.SetState(manager.GetState("DodgingState"));
        }
        public override void ExitState(PlayerStateManager manager)
        {
            manager.Player.DoDodge = _ => { };
        }

I can't seem to use the dodge method in PlayerMovingState

#

sorry for the wall of text

granite sun
outer verge
#

What do you guys use to control input system, player input component with send messages, unity event or generate c# script? I saw many use the "generate scripts" way but I don't see any benefits from it than others.

austere grotto
#

Basically the delegate thing you're trying to do isn't going to work

austere grotto
full gull
#

how can i make so i can controll the mouse with right stick on gamepad

stable coral
#

sad that this has no answers yet

opaque rune
#

does anyone know how to fix this error?

#

it was working perfectly fine the other day but now its giving me this

jagged wyvern
#

i believe there are two scripts called playercontrolls

#

idk tho

opaque rune
#

there shouldnt be tho

hexed egret
#

ok, so I have a simple issue. I have this function to handle input: ```csvoid MyInput()
{
horizontalMovement = Input.GetAxisRaw("Horizontal");
verticalMovement = Input.GetAxisRaw("Vertical");

    moveDirection = orientation.forward * verticalMovement + orientation.right * horizontalMovement;

    Debug.Log($"Jumps: {jumpsRemaining}. Key: down this frame {Input.GetKeyDown(jumpKey)}, is currently down {Input.GetKey(jumpKey)}");

    if (Input.GetKeyDown(jumpKey) && jumpsRemaining > 1)
    {
        print("The player should be jumping!");
        jumpsRemaining -= 1;
        // Jump
        Jump();

    }

    isCrouching = Input.GetKey(crouchKey);
}``` It is called every `Update()`.

My issue is, the if statement which calls the Jump() is not commencing even when jumpsRemaining is 2. This behaviour only occurs however, only if Input.GetKey(crouchKey); is true. I am very confused and I have no idea what to do. Any help would be appreciated

small saffron
#

I've got an on-screen joystick and an on-screen button. I can do them both individually without issue in Remote on my Pixel 4a, but when I use the OSB it makes the joystick stick for a bit.

Works
Mouse to move joystick in Game window + spacebar
Touch on Pixel to move joystick + spacebar on computer  works
WASD to move character + spacebar / click / button tap all work

Sticks
Mouse to move joystick + tap on button = sticks
Touch to move joystick + tap / click on button = sticks```

So anything that involves clicking/touching the on-screen button at the same time as clicking/touching the on-screen joystick is causing the joystick to stick for a few seconds.

I'm still digging on this and know the Remote 5 + new input system is wonky, but I'd appreciate any ideas.
cyan marten
#

How do i get the Vector2 position of the mouse with the new input system? I already created a value "MousePosition", how do i use it im my code?

austere grotto
#

Wdym by you "created a value"?

delicate pollen
#

Any obvious reason why the InputSystem isn't detecting my gamepad's right trigger during gameplay? It's an Afterglow 360 pad and I set it in the InputAction using 'listen', so it's definitely finding the input in Editor, but during Play mode I'm only occasionally getting a response while I'm holding and/or pressing the trigger.

austere grotto
#

what's your Input Action setup and your code

delicate pollen
#

controls.BipedMovement.fwdInputRaw.started += ctx => fwdInputRaw = ctx.ReadValueAsButton();
controls.BipedMovement.fwdInputRaw.canceled += ctx => fwdInputRaw = ctx.ReadValueAsButton();

#

Actually, maybe I should be using Performed...

#
  • sigh * Yep, performed works perfectly, thanks. =)
graceful echo
#

so trying to follow this video about the new unity input system and for some reason my right click menu doesnt have a bunch of the options his does. the tutorial man is on the top mine is bottom

#

kind of need that

#

ok another tutorial man showed i had to go to "value" instead of "button" and set the control type to Vector 2

graceful echo
#

is "save asset" just gone now?

#

like this tutorial was from this month

graceful echo
#

oh its disabled when pressing auto save i guess. odd i thought i saw tutorial man have both available unless i just didnt notice

sudden lagoon
#

Question. Can in one scene there be two PlayerInput? one on character with Default map of Player, and one on UI with defautl map of UI. Or There should be some other way to handle it?

royal solstice
#

Hello! I connected a new input system and used it in the project. But now when I tried to install the "Joystick" package or use the Button in the canvas, I get the error "... switched active Input handling to Input System package in Player Settings."
So the new input system doesn't work with "Joystick" and Canvas?

royal solstice
# austere grotto Can you show the full error?

InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings. UnityEngine.EventSystems.BaseInput.GetButtonDown (System.String buttonName) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/BaseInput.cs:126) UnityEngine.EventSystems.StandaloneInputModule.ShouldActivateModule () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:227) UnityEngine.EventSystems.EventSystem.Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:474)

austere grotto
royal solstice
austere grotto
#

Go to your EventSystem

#

upgrade your input module

#

The new input system is enabled just fine

royal solstice
austere grotto
#

The new input system includes an on-screen joystick feature already though so you shouldn't need any such asset

royal solstice
crimson crater
#

Is there some kind of unique identifier for Input Devices that stays the same even if they get disconnected then reconnected? I tried the deviceID but it changed when I tried that with a controller

crimson crater
#

Nvm, apparently no

candid bramble
#
xRotation = 0f;
xClamp = 85f;
void update()
{
        RotateViewHorizontal(mouseInput); //rotates mouse

        Player.Rotate(Vector3.up, mouseX * Time.deltaTime);

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -xClamp, xClamp);
        Vector3 targetRotation = CamRotator.transform.eulerAngles;
        targetRotation.x = xRotation;
        CamRotator.transform.eulerAngles = targetRotation;
}
void RotateViewHorizontal(vector2 mouseInput)
{
mouseX = MouseInput.x * SensitivityX;
        mouseY = MouseInput.y * SensitivityY;

        Player.Rotate(Vector3.up, mouseX * Time.deltaTime);
}

When trying to lock the mouse input for the y value it locks also for the x 🤦🏻‍♂️
anyone knows why?

specifically if xRotation -= mouseY; exist than it works for the y axys, but if its marked as a comment it works only for the x. :(

austere grotto
candid bramble
#

After many changes to check things and test it, it is a little spaghetti but I can organize it if you want:

//Inputs
    public InputMaster Director;

    //PlayerMovement

    //MouseLook
    public float SensitivityX = 8f;
    public float SensitivityY = 0.5f;
    float mouseX, mouseY;

    float xClamp = 85f; //Lock Rotation
    float xRotation = 0f;

    [SerializeField] GameObject CamRotator;
    [SerializeField] Transform Player;

    Vector2 mouseInput;
    private void Awake()
    {
        Director = new InputMaster();
        

        Director.Player.MouseX.performed += ctx => mouseInput.x = ctx.ReadValue<float>();
        Director.Player.MouseY.performed += ctx => mouseInput.y = ctx.ReadValue<float>();
        Debug.Log("Done Orginizing Controls");
    }

    private void Update()
    {
        MouseLook();
        Player.Rotate(Vector3.up, mouseX * Time.deltaTime);
    }
    void MouseLook()
    {
        RotateViewHorizontal(mouseInput);
        RotateViewVertical();
    }
    void RotateViewHorizontal(Vector2 MouseInput)
    {
        mouseX = MouseInput.x * SensitivityX;
        mouseY = MouseInput.y * SensitivityY;
    }
    void RotateViewVertical()
    {
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -xClamp, xClamp);
        Vector3 targetRotation = transform.eulerAngles;
        targetRotation.x = xRotation;
        CamRotator.transform.eulerAngles = targetRotation;  
    }
    private void OnEnable()
    {
        Director.Enable();
    }

after following this tutorial: (from 18:57) https://www.youtube.com/watch?v=tXDgSGOEatk

stable coral
#

Okay so i have an issue atm. For my local multi i want to make it so that only one player at the time can select a character instead of making it so all players can select at the same time since i need the whole screen to be used so doing some split screen things wouldn’t be so nice. Is there a way to disable inputs from all players except for the one who is actually selecting a character?

#

I feel like it’s extremly basic but i’ve been extremly confused lately

#

Now that i think about it, maybe disabling the PlayerInput component on each player through FindObjectsOfType (except for the one who is selecting a character) would work? And then re-enabling it when the player is done

#

Still unsure on how to check WHO is selecting though, could be anyone and it could randomly disable the selectors controlls. So yeah, any ideas?

wanton egret
#

hey guys

Unity's new input system has 4 ways to listen and trigger actions as per some button bindings.
Send messages, Bordcast messages, invoke unity events, and invoke c# events.
Which ones do you prefer ?

austere grotto
#

The new input system has a lot more ways than that

#

That's just the 4 modes of the PlayerInput component

#

which is itself only one of many possible approaches

#

I typically prefer to use InputActionReference and deal with InputActions in my code directly - either subscribing to events or polling in Update, depending on the use case

wanton egret
wanton egret
#

sorry I am quite new into this. so there's still some confusion

austere grotto
#

There's also the generated C# file, defining raw InputActions on your MonoBehaviours, Using an InputActionAsset reference directly, creating inputActions etc. dynamically in code. The list goes on

wanton egret
#

I am pretty sure. I am missing something very silly here.

But I need one more help.
I've one input action asset and a script file defining player movements.

If I decide to follow events way, the idea is to select the method which will be called from that script file during run time for some particular context.
Thing is, for some reason it is not at all detecting any methods from my script file.
For the sake of this problem. I have all my methods public

#

Any suggestions on how to handle this ?

austere grotto
#

you need to drag the object that has the script attached to it into that slot

#

Also, the functions need to take an InputAction.CallbackContext parameter. Right now you have them taking no parameters.

wanton egret
#

Thank you very much
Today I was checking out CodeMonkey Tutorial on using this inputsystem.
And instead of adding object I added script
I made this mistake there.

brave burrow
#

is 2d vector no longer an option for the input binding system?

austere grotto
#

It's still an option

#

What makes you think not?

brave burrow
#

I remember it being an option in a project I was working on in the past 2 weeks but now I can't find it

austere grotto
# brave burrow

It needs to be a Vector2 action before you can add a 2D composite binding

#

value/Vector2

#

Action Type : Value
Control Type: Vector2

brave burrow
#

ohhhhh

#

ty

#

very new to this lol

jagged wyvern
#

I notice a pattern in the questions we get here

stable coral
#

too bad none of the more complex stuff gets asked though so it's more difficult to find answers about em

#

i prolly should read the documentation a bit more but i doubt it will help a lot

jagged wyvern
#

if the simple stuff was well documented then we wouldn't have to keep getting questions about the same things

stable coral
#

^^

jagged wyvern
#

unity needs to get someone from the community to help them write more beginner friendly guides

#

unfortunately though it feels like they abandoned the new input system

stable coral
#

i feel like the documentation in general is just a bit too empty,

#

wait what?

#

ffs

jagged wyvern
#

they think it's complete and doesn't need to be revised

stable coral
#

well fuck, i guess i gotta invent my own logic then

#

for example one thing i do dislike is split screen with 3 players. feels like i gotta manually set it up

#

because it will always be one empty window in the corner which is not so nice, so i gotta manually set the camera view for each player instead

naive oriole
#

hi i have a question with the new input system, im using this method but i was wondering is there something equivalent to the opposite of IsPressed?

stable coral
#

”!value.isPressed”?

#

Without the ? And ” ofc

naive oriole
#

it doesnt look like it triggers, im looking for something that triggers after the button has been pressed, a key release to be exact

jagged wyvern
#

make another input action with a release interaction

naive oriole
#

aight, new to unity but not ue4 so any help is appreciated lol
thanks will take a look

mental musk
#

If I have 2 control schemes, one for Ps4 gamepads and one for gamepads generally, Unity will pick PS4 when I plug in a PS4 controller right? Not gamepad because it's a type of gamepad?

delicate pollen
#

Hey folks - I'm using the new InputSystem and I'm subscribing to InputAction events with a lambda in order to get player input.

controls.BipedMovement.MoveWalk.performed   += ctx => moveInputRaw  = ctx.ReadValue<Vector2>();

Normally I'd try to unsubscribe from events in Unity, as afaik it's one of the only ways to create memory leaks in Unity. However, I can't really do that with a lambda, and the alternative appears to be writing a bunch of methods to register to the separate events which is going to involve a ton of me repeating myself and seemingly pointless busywork.

Is it possible to just leave the lambdas subscribed without risking unsafe Unity behavior, or do I need to build a ton of slightly-different bespoke methods?
(Related Unity Forum thread: https://forum.unity.com/threads/using-inheritance-for-tidiness-eg-registering-with-inputaction-events.1241395/#post-7903231)

austere grotto
#

Hey it's me!

delicate pollen
#

Ah, it's yourself!

#

I was kinda hoping I might see you here. =)

austere grotto
#

So the real risk here is if your controls object is more long lived than this script, then when this script is destroyed (either by explicitly destroying it or during a scene load), then you will have these leaked subscribers. SO yeah you will have a memory leak in that case

jagged wyvern
#

isn't there a performed.clear

austere grotto
#

But since you're creating the controls inside the script itself, that's not a real worry

#

Since controls itself will be garbage collected at the same time this object is

delicate pollen
#

Soooo, if I'd created the 'controls' object somewhere else, then... aaaahhh. I getcha.

austere grotto
#

So you only need to worry if you're sharing controls with some other object, but it seems to be private so yea

delicate pollen
#

So actually I can just subscribe with lambdas in OnEnable and it'll get cleaned up when the object that contains the script that created controls is destroyed.

#

Can I get a quick thumbs up on my last statement there? Otherwise, thank you, @austere grotto , I've been tying myself into a bit of a pickle with this whole thing and you've straightened that right out.

austere grotto
delicate pollen
#

I'll keep that in mind. The plan is that it would be unique per player (and atm I'm only planning for one player on this game).

#

(I had visions of basically quadrupling my input script size. 0_o)

austere grotto
# delicate pollen (I had visions of basically quadrupling my input script size. 0_o)

You might also consider a slightly different approach instead of going event-based. Like instead of having these fields that you update via events you could just get the values on demand, which is how you're doing it anyway. Like:

public class InputHandler : MonoBehaviour {
    private PlayerControls controls;
    public Vector2 MoveInputRaw => controls.BipedMovement.MoveWalk.ReadValue<Vector>();
    public bool RunInputRaw => controls.BipedMovement.RunModifier.ReadValue<float> != 0;
    public float FwdInputRaw => controls.BipedMovement.fwdInputRaw.ReadValue<float>();
 
    void Awake()
    {
        controls            = new PlayerControls();
    }
 
    void OnEnable()
    {
        controls.Enable();
    }
}```
#

This may simplify things a lot

#

Since you're only going to read that data on-demand in your other scripts anyway

granite apex
#

Is it wrong to declare InputActionReference in several MonoBehaviour components and then drag&drop the same InputActionReference from InputActions asset to setup controls?

#

I'm trying to remove the dependency from the Input Manager and isolate components such as Camera Manager, Menu Navigation Manager, etc.

austere grotto
#

The only thing you should be aware of is that they will all share the enabled/disabled state for those actions and action maps

granite apex
#

But that's the point if I use WASD to move camera and navigate the pause menu. As for enabling/disabling, I thought that it's the responsibility of each manager to know when no to read input, correct?

stable coral
#

uh how do i convert from InputAction to InputActionRefrence?

old matrix
#

So I am trying to get the mouseposition for my camera looking around, and while it works, it stops as soon as my cursor hits the borders of my screen. Is there a way I can avoid that? (I could use Delta mouse but that's really jittery because half of the inputs are 0, for some reason.)

austere grotto
stable coral
#

oh.. i was just trying to assign these through code

austere grotto
austere grotto
stable coral
#

yes

austere grotto
#

Why do you need to assign them in code?

#

For rebinding?

stable coral
#

oh hang on i thought it was dependent on certain components, i guess i can just leave it premade in the scene

stable coral
austere grotto
#

I just thought maybe you were trying to rebind the input actions that correspond to these things in your menu or something, that's the only reason i could imagine someone trying to set these in code

stable coral
#

ah

#

how would i do that then?

#

(in case i need it for future purposes)

austere grotto
#

There's an "interactive rebinding" feature

#

It will let you change the bindings for a given InputAction at runtime

#

I've never really used it yet

stable coral
#

ah i see

old matrix
austere grotto
shut tiger
#

Hello guys, we are working in a new project at the office, with the Input system but we are facing an issue, the guy in charge of it configured it, it is working great on his end, but he pushed it all to git after retriveing it on our side to try it also The input system seems bugged and don't find any of the Devices we have

#

anyone have an idea ?

#

here is all the screenshot with what could be "interesting" for you to help me investigate or give me a clue about it

#

OK .... seems like i found a bug

#

the issue was when recompiling the project from git when it's already started (and importing the inputmanager in that said pull)

#

devices are not being detected

#

i had to restart Unity

#

to make it work

stable coral
#

Is it possible through an ui button to see which player is clicking it? For example if player 3 clicks on a ”select character” button or ”change teams” button, how do i make it so that it knows player 3 did so?

sleek pasture
#

Input System's InputActionAsset = new InputActionAsset() limited to one time use? I can't have multiple GameObjects with this command?

delicate pollen
austere grotto
viscid garden
#

Using the new input system, I am finding that when pressing multiple WASD keys at once to drive the rigidbody, I get wonky results. Like it doesn't care what keys I press when 2 or 3 keys are pressed together. I am using a vector2 composite.

#

movementVector comes from the Callbackcontext

#

Any advice?

austere grotto
viscid garden
#

Looks like it was acting funky because each new button press was adding more force, and replacing addforce with just setting the velocity directly fixed it. But to answer your question:

Inputsystem fires C# event with Vector2, then that subscribing method fires an event that calls Move with Context.ReadValue<Vector2>

#

If you know a better way than using that if statement in my MoveKeyHandler function btw, i'm all ears. I could have sworn there was a way to use one event and then use the context to determine performed vs cancelled.

#

This is my first time using the new input system, watched a bunch of videos but obvious gaps in my knowledge here.

austere grotto
#

But you're kinda overcomplicating this by going event-based for a continuous input like a movement vector

#
void Awake() {
  _playerInputActions = new PlayerInputActions();
  _playerInputActions.Enable();
}

void Update() {
  OnMovement?.Invoke(_playerInputActions.Player.Movement.ReadValue<Vector2>());
}```
viscid garden
#

So you're not actually subscribing to the key/input events

#

You're just checking every frame to see if the vector has changed, which is basically the same thing?

#

Am I understanding you properly?

austere grotto
#

Yes

#

I'm not even checking if it changed

#

just reading it every frame

#

honestly this might be even better:

void Awake() {
  _playerInputActions = new PlayerInputActions();
  _playerInputActions.Enable();
}

public Vector2 CurrentMovementInput => _playerInputActions.Player.Movement.ReadValue<Vector2>();```
#

Using events makes more sense for a button or something

#

for a joystick-style continuous input thing, I think it's cleaner to just poll it

viscid garden
#

I think I am doing what you just posted, only difference is that I have a input script and a movement script, so the event is important for me to communicate between scripts.

#

Thanks a lot for helping me simplify my code.

austere grotto
#

with this setup, the movement script can just as easily read the public property as it can subscribe to the event

viscid garden
#

Ah I didn't see it was public. I thought you were just thinking this was operating within one script.

austere grotto
#

Nah I realized due to your event usage

viscid garden
#

I often struggle with 'best practices' when it comes to trying to get data from 1 script to another script. In this case they're both on the same gameobject so are you suggesting I do this?

#

Those are the two scripts

#

In my limited time programming, 'best practices' hangs over my head like a curse. This here makes me think "Oh no, playermovement is tightly coupled with playerinputmanager. bad practices!" so please let me know what you think

austere grotto
#

Subscribing to the event is just as tight a coupling

viscid garden
#

Yeah I suppose you're right. I feel like events were touted as the solution to tight coupling, but then I don't know how you subscribe without knowing who's broadcasting😦

#

Thanks again

stable coral
#

Is there a list on which devices are supported? the listenting function wont listen to my logitech extreme 3d pro for some reason

#

however i can join with it, which is odd

#

uh nvm

#

i dont think it recognises all of the buttons though which sucks

edit: it does and i mapped out all of the buttons so now i know what button corresponds to what input

blissful comet
#

How might I set up an action for movement such that it's controlled either by a joystick on a gamepad or mouse movement while the right mouse button is held? I can see how to add a modifier to a button, but not sure how to do so with an axis. Would I just need to have it be a separate button and check for it in code before calling anything subscribed to Aim?

gleaming oar
#

you could have a certain control setup with whatever functionality you want and only enable it when the right mouse button is held

#

have your first control enable the second set of controls

blissful comet
#

Ah, I never actually thought of having conditional .Enable and .Disable calls, that seems like the perfect solution. Also, Delta [Mouse] is what I want to use to emulate "Mouse X" and "Mouse Y" in the old input system, right?

gleaming oar
#

yeah that will track the change in position of the mouse on both axes

blissful comet
#

All right, thanks 👍

#

Oh, and I could even avoid having to detect whether it's keyboard or mouse by binding all directions of the joystick to that action as well, huh? Then moving the joystick would also enable the joystick aiming

#

I'll have to see if that works out once I finish converting over all this old Input system code...

gleaming oar
#

what I have been doing is building out controls for both mouse and other input methods and enabling both on startup, so either could be used or they could be used simultaneously...I might put in an intermediate manager that enables/disables an input method based on whatever criteria I think fits switching over...not sure how I might do that

stable coral
#

uh big problem.. ish

#

so i got these 2 bindings. one is a 2d vector (kb/controller) and the second one is for my joystick which is an axis

#

how would i make it so that they can work in the same method?

viscid garden
#

Is delta mouse what I want to get the direction to fire a bullet from the player for a top down shooter?

austere grotto
#

so to start - you want mouse position not delta

stable coral
blissful comet
#

I think I have misunderstood something about actions. I have this binding here. From what I understood, I could subscribe to performed and the code in there would run while the button is held, and the canceled would run when you release it. I'm not able to get any canceled event to run. Did I set something up wrong? Or misunderstand what the interactions do?

#

Yeah, just getting rid of the interaction seems to give me the behavior I want. What does canceled mean for a Hold interaction then?

austere grotto
gleaming oar
#

the interactions don't really work for me either, so if I want a delayed input I have to use a coroutine

spark pumice
viscid garden
#

I'm trying to make it so my top down shooter, when played with a gamepad, has a reticle you can move around with the right stick. I believe the best bet is a virtual mouse, but i'm struggling between editing the virtual mouse with the real mouse, as I want you to be able to switch between control schemes as will and have the mouse position and the virtual mouse position to remain the same.

Any advice? I know there's a OnControlsChanged event but I don't use PlayerInput class/component, so I get it by checking context.control.device on each device I have setup.

I feel like the moment I add a virtual mouse, Mouse.current becomes the virtual mouse and I don't know how to get the normal mouse back.

odd hill
#
  //public void OnLook(InputAction.CallbackContext context)
{
    lookVector = context.RealValue<vector2>();
}

public void Rotate()
{
    rotate.y += lookVector + lookSensitivity * Time.deltaTime;
    transform.localEulerAngles = rotation;
}

public void OnJump(InputAction.CallbackContext context)
{
    if (characterController.isGrounded && context.performed)
    {
        animator.Play("Jump");
        // Jump();
    }
}

    private void Jump()
    {
        verticalVelocity = Mathf.sqrt(jumpHeight * gravity);
    }
} 
#

it says something in my code is using the old input system when I set my project settings to the new input system

#

this is part of the code

fleet pasture
#

I'm trying to hook up Unity's new input system. And when I stuck the script onto my my player input component and clicked on the little dropdown menu the only thing that popped up was monoscript and let me make a string. I double checked and this code appears to be correct. But it still won't work. I am confused plz help.

jagged wyvern
#

drag the game object

austere grotto
austere grotto
viscid garden
#

Got a few questions regarding my understanding of how the input system works.

So i've got this.

#

And if I type something like:

_playerInputActions.Player.AimLook.ReadValue<Vector2>

Which one is it going to get?

#

From my understanding, all 3 of those can have a vector2

bronze ridge
#

how do i check if only one button has been pressed instead of both?

#
public bool isAiming { get { return (playerInput.input.locomotion.MouseButton.IsPressed()); }}

for example this just returns true if either one is pressed

#

but i want isAiming to be true only if the RMB is pressed

#

do i need to create a different action for each separate button?

mortal swift
#

Oh my gosh, I've just been on the weirdest goose chase in my life.
I basically have figured out that with my G502, if this setting here which appears to be the default setting is set, the mouse movement in the FPS core template (and even just a normal inputsystem delta based rotation in a blank project) is extremely jittery.
But if the rate is turned down to 125, that works as expected - and plugging in a regular office mouse also appears to work normally.

#

It's literally just a fresh install of 2020.3.29f1, freshly downloaded "First Person Core" project, with all G502 hub settings restored to the default, at 800 DPI, including the report rate at 1k - jittery and useless.

#

I'm going out on a limb here but has anyone around here had issues with anything like this lmao?

mortal ridge
mortal swift
#

Sorry I feel like it's pretty directly correlated - this occurs specifically in unity only, specifically with the input system only.

#

It appears the high poling rate on this mouse breaks the reading of the delta

mortal ridge
#

It's Not a code related question

mortal swift
#

Of course it is. Obviously the polling rate is changing how the inputsystem processes the mouse delta InputAction. What I'm asking, is if anyone else has had any issues related to mouse polling rates causing the delta read by Unity's inputsystem to jitter/skip values, and if so what actions could be taken to ensure a smooth experience even on a high poll rate mouse.

#

The channel does also say "Discuss anything related to Unity's input system"

mortal ridge
#

The channel is also under the scripting topic

mortal swift
#

Okay, well I'll let a mod sort that out with me if I've broken a rule ☺

mortal ridge
mortal swift
#

doesn't that really prove it was an input system and code related issue the entire time haha

#

like I said friend, if you'd like to ask a mod to caution me or what have you that's just fine, otherwise you are welcome to ignore my posts until your heart is content

#

I would still like to have a discussion with anyone who knows a bit deeper how the input system's internals play with mouse polling rates, but if that's anyone feel free to DM me as apparently that isn't welcome here lol

mortal ridge
spark pumice
# bronze ridge do i need to create a different action for each separate button?

The purpose of the input system design is that your action (what you've called "MouseButton") corresponds to a single action in the game. I would create an "Aim" action that is only bound to RMB, and have a different action with LMB bound to it named appropriately (maybe "Fire"?).

You could figure out which button is pressed with your current setup, but it would be overly complicated and making a clearer InputAction setup closer to how it is designed to work will just be less of a headache.

bronze ridge
delicate pollen
#

Just wanted to check something @austere grotto - putting a Lambda into a variable means that the function is only run when the variable is requested, right? Making sure I understand this...! (Following up from your recent advice regards getting InputAction data through vars)

mortal ridge
#

yes. EVERY time the variable is requested

delicate pollen
#

Ah, that's useful @mortal ridge ,thank you!

glass yacht
sinful warren
#

So i'm making a co op game with the new player input and i got it to work but when i get another prefab to join Im controlling both

#
    public void ProcessMove(Vector2 input)
    {
        Vector3 moveDirection = Vector3.zero;
        moveDirection.x = input.x;
        moveDirection.z = input.y;
        controller.Move(transform.TransformDirection(moveDirection) * speed * Time.deltaTime);
        playerVelocity.y += gravity * Time.deltaTime;
        if (isGrounded && playerVelocity.y < 0)
            playerVelocity.y = -2f;
        controller.Move(playerVelocity * Time.deltaTime);
        Debug.Log(playerVelocity.y);
    }

    public void ProcessMove(InputAction.CallbackContext ctx) => movementInput = ctx.ReadValue<Vector2>();```
odd hill
#

can anyone help me

#
{
    lookVector = context.RealValue<vector2>();
}

public void Rotate()
{
    rotate.y += lookVector + lookSensitivity * Time.deltaTime;
    transform.localEulerAngles = rotation;
}

public void OnJump(InputAction.CallbackContext context)
{
    if (characterController.isGrounded && context.performed)
    {
        animator.Play("Jump");
        // Jump();
    }
}

    private void Jump()
    {
        verticalVelocity = Mathf.sqrt(jumpHeight * gravity);
    }
} ```
 
it says something in my code is using the old input system when I set my project settings to the new input system
this is part of the code
austere grotto
#

The error message will show which file and line number the problem is happening at.

rose hearth
#

I am using GetAxis("Mouse X") but it kinda steps the movement, as if the mouse delta was in integers. Is this a preblem with the gravity, sensitivity and dead settings ?

hybrid umbra
#

Can I read mouse scroll wheel as button?

granite apex
hybrid umbra
#

For a certain amount

willow violet
#

Has anyone replaced EventSystems for interfacing with new Input? i.e. making Input work with UnityUI, or with general GameObjects, etc.

I kept running into major bugs when using new Input with EventSystems, and started reading all the source code. After a week of analysis and debugging, I've come to the conclusion that I can replace the entire thing with something a lot easier to use, that's actually extensible (most of EventSystems isn't - and it makes it artificially difficult to extend parts of Input) ... and that won't have any of the bugs :).

But it seems like I must be missing something here - surely someone else has already done this?

granite apex
distant glacier
#

Hi guys. Please, I need some help with my problem. I want to create infinite bouncing ball in 3D, but there is a problem. After few bounces, bounce height is lower and lower .. any ideas ?

willow violet
#

Not related to input, but ... I assume you're using physics to do the bounce, in which case: stop using physics to do the bounce, do it in code. Make the position.y follow the first half of a sin-wave, and it will look exactly like a bounce.

distant glacier
austere grotto
median geode
#

I have a TapInteraction on a WASD action, that should output a directional vector2, which it does for any other interaction than TapInteraction. Does anyone have any idea why it might fail to output anything other than the null vector?

#

My only guess currently is that the time for it to register an input is longer than the tap duration, but I don't seem to be able to solve this.

upbeat cape
#

Hello, did anybody had problem with custom cursor not loading properly at build? In editor it works fine but in builded game its a pixaleted mess like in the image

austere grotto
viscid garden
#

Do you guys typically use value or passthrough?

mortal ridge
#

Value. Passthrough is supposed to be used rarely

flat blaze
#

Am I able to use the normal input manager instead of Input System package without effecting scripts on the FPS preset and if so, how?

#

nvm

delicate pollen
#

Hey folks, attempting to get a Left Click from my mouse via a lambda... and failing. Code and screenshot follow...
[HideInInspector]public bool MouseLeftClick => controls.BipedMovement.MouseLeftClickOnce.ReadValue<float>() != 0.0f;

#

Tried it with a straight Bool in the ReadValue, but that didn't work either.

untold gulch
#

Why not controls.BipedMovement.MouseLeftClickOnce.WasPressedThisFrame()?

#

Though if you only want this to be a mouse click, why set up an action for it? You can do Mouse.current.leftButton.wasPressedThisFrame

delicate pollen
#

Why not indeed * 2! =D

#

I'll give that a try in a minute, thank you...!

untold gulch
#

No problem

delicate pollen
#

Just checking, is there any reason to not use Mouse.current.leftbutton.wasPressedThisFrame?

untold gulch
#

If all you want is to check for a left mouse click, I don't see any reason not to use it

#

Just keep in mind that Mouse.current will be null if there is no mouse (like on a console or mobile device)

delicate pollen
#

Just thinking, I might also want to have a tap from a touch-screen do the same thing.

untold gulch
#

For that there's Touchscreen.current.press.wasPressedThisFrame, I think

#

But of course, you'd need to check for Touchscreen.current being null

#

So if you want to easily support both mouse and touchscreen, then in that instance I think an action might make sense

delicate pollen
#

Right, so... I need to wrap the references to the variables in a check for null...

#

Yeah, that was my thought.

#

Basically I'm hoping to get the same outcome.

untold gulch
delicate pollen
#

10-4! Thank you!

untold gulch
#

Np!

sinful warren
#

Im having a problem where when I spawn to players in the controller/keyboard controls both characters

viscid garden
#

How do you differentiate between a virtual mouse and the hardware mouse? I find that after I create a virtual mouse, Mouse.current is always the virtual mouse, even when im waving around my hardware mouse.

untold gulch
#

I'm not aware of any other way, since the built-in virtual mouse stuff just extends the regular mouse class

#

Looks like that's how Unity's own test code checks it too:

#

Checking for the hardware mouse should be if (Mouse.current.native)

viscid garden
#

Ty

odd hill
#

I don’t know why

#

I thought it was cuz I needed to update my visual studio code

#

But it’s not letting me update that either

#

This was the error I think

#

Yeah

untold gulch
#

Why are these photos instead of screenshots lol

#

Press windows + Shift + S to activate the snipping tool and then drag over a section of your screen, then you can paste it in chat

#

Anyway, that error is because you have the old input system disabled. You need to go into Edit -> Project Settings -> Player -> Active Input Handling and set it to "Both"

austere grotto
#

That's not the right fix

untold gulch
#

The "right" fix is to use the new input system everywhere, sure

austere grotto
#

Yes

untold gulch
#

But they wanted to know the cause of the error

austere grotto
# odd hill

Anyway the highlighted error (MisdingMethodException) is due to using PlayerInput with SendMessages mode without implementing OnMove.

The other error we can't say the source of because you're not showing the full error for that one

viscid garden
#

Why is it that:
if (context.control.device == Gamepad.current)
returns true when using the left stick but not the right stick?

untold gulch
#

Try logging context.control.device.path

viscid garden
#

Thanks.

#

I'm tinkering with a virtual mouse to try to get a cursor on right stick and i'm way over my head.

#

Turns out when I use right stick its no longer the controller but the virtual mouse

untold gulch
#

I suppose that makes sense -- while the virtual mouse is active that would prevent "game" inputs going through

#

So you wouldn't start making your character look around with a menu up or something

#

If you're using the VirtualMouseInput component, iirc there's a property on it that allows you to disable the virtual mouse when you don't need a cursor

#

cursorMode, that's it

#

Or not, my bad -- instead you should be able to just disable the component

#

Which will disable the virtual mouse device and restore the gamepad + hardware mouse

viscid garden
#

So i'm quite new to the input system and i'm not using any components, just the C# Class

untold gulch
#

Referring to this

#

I'd recommend using that if you aren't already, it handles a lot of the functionality for you

viscid garden
#

Should I be using a virtual mouse for this? Let me explain my use case.

I have a top down shooter and I have an aiming sprite. I want to control this aiming sprite either with mouse or right stick on a gamepad. I don't think i'll want the player to navigate UI ever with the right stick, only with the D-pad up/down arrows and such (or mouse/keyboard of course).

untold gulch
#

In that case I wouldn't personally use a virtual mouse

#

I'd just treat the stick input as movement

#

I'd only really use a virtual mouse as a temporary alternative to implementing full controller support in UI

viscid garden
#

I was mostly following a tutorial that I think was based around virtual mouse and using a gamepad to click on canvas elements.

#

I'm going to try your suggestion.

#

I think I need some sort of intro course on the new input system, I am not skilled enough to read class files on github for instruction, and docs are a little tough sometimes too.

untold gulch
#

That's understandable, the new input system is vastly superior to the old one and it's really nice when everything clicks, but there's definitely a lack of concise documentation on how to get started

viscid garden
#

Also I tried your suggestion about context.control.device.path now that i've removed the virtual mouse and it seems right stick doesnt get picked up at all.

untold gulch
#

It doesn't help that a lot of the third party tutorials and such are either based on really old versions, or tell you to do the wrong thing

viscid garden
untold gulch
#

That seems odd, what if you remove the VirtualMouse binding?

viscid garden
#

That was it, removing the binding

untold gulch
#

Very strange

#

I would have expected it to have no impact if the device was disabled

viscid garden
#

Maybe I messed something up and hadn't saved my input actions recently.

#

I saved after removing the binding

#

Thanks

untold gulch
#

Possible

delicate pollen
#

Hey folks - just testing this code:
[HideInInspector]public bool MouseLeftClick => controls.BipedMovement.MouseLeftClickOnce.WasPressedThisFrame();
Unfortunately, I can't seem to get it to register a click (a positive bool)...!

viscid garden
#

Debug.Log(context.control.device.path);

Any reason why this code doesn't register my right gamepad stick when the action type is on Value, but it works just fine when on passthrough?

mortal ridge
uncut depot
#

so Im using this for movement now, and the problem is that its so unresponsive. like it takes 3 seconds to register the press. any tips to fix?

austere grotto
#

Also you're overcomplicating it

uncut depot
#

yeah i was using this before, but the other guy told me to switch to events. Basically, the isMoving variable being true, allows a function in another script to do the movement

#

so reading the vector 2 values as the input.x and input.z

#

before when i was using this it was responsive, but when I load from a different scene, and i press, it would just read 0,0 for the vector2 value, until i release the button and press again

mortal ridge
#

why are you still f*** using FindAction()???

#

also you have a lot of redundant code

uncut depot
#

well u just said learn events

#

ok whats the redundant part. is it sectioning it off ointo parts?

mortal ridge
#

1 - you don't need to check for cancelled or anything if you already subscribe your method to the cancelled event

#

2 - you can reference the actions with strong names

uncut depot
#

seems to be working as intended now.

#

should i maybe combine this and the movement stuff into 1 script? was thinking to do this in FixedUpdate but if i do it in a separate script the movement part doesnt occur.

mortal ridge
#

don't ever do non physics related things in fixedupdate

uncut depot
#

so this is the bottom part of my 2nd screenshot. so the move uses physics, but i can keep as is then? as in for the button press check stuff in Update

viscid garden
mortal ridge
viscid garden
#

Yeah turns out the input debugger does show signal when im using it

mortal ridge
#

why are you multiplying by -1 anyway?

viscid garden
#

I feel like my device check method is poorly written, or that the currentAimInput can be updated better but i'm not sure how. Anyone want to share their opinions of my code and tell me how I could make it easier to read or something?

This is basically just to clamp my texture to the mouse/gamepad depending on which device last called .performed , and I have another script that reads the currentAimInput and determines whether or not to flip the sprite on the X axis depending on what side of the cursor he's on

#

So my screen bounds are -8, -5 to 8, 5. I multiply by -1 to get the left bounds

mortal ridge
#

why don't you simply negate

viscid garden
#

oh of course.

#

Thanks for that. One bit tidied up better 😄

blissful comet
#

Is there an equivalent to Input.inputString in the new Input System or am I going to need to build up an action map of every possible key on the keyboard?

mortal ridge
#

maybe get it with key.any?

blissful comet
#

Possible. Is there a quick way to get the string representation of a key or do I need to make a dictionary to map them?

jagged wyvern
mortal ridge
indigo patrol
austere grotto
prisma crane
#

Hello guys, I'm kind of new to Unity still, and I have an issue with the new input system: I coded some simple top down movement a few months ago (and reinstalled windows without saving my work), and now the same exact implementation doesn't seem to be working anymore.

I followed 3 different tutorials and did exactly what those guys did, but unity doesn't want to read the input anymore

The only hunch I have is that in Project Settings I can't chose .NET 4.x, I only have .NET Standard 2.1 and .NET Framework. From what I've seen, Framework should include 4.x or something like that? I know 4.x is needed for the input system to work, and I'm pretty sure Framework worked in the past.

The coding part is pretty straight-forward and shouldn't (in theory) be the problem, but if you don't have any idea why I'm encountering this issue I'll provide it

prisma crane
#

it doesn't work

mortal ridge
#

most likely a code problem then

prisma crane
#

it's not moving whatsoever

mortal ridge
#

move literally everything in FixedUpdate() OUT of FixedUpdate() for a start

prisma crane
#

just regular update then?

#

yeah it worked

#

tutorial guy betrayed me

#

thank you so much, i've struggled with this for 2 hours, and it was so simple :))))

mortal ridge
#

and subscribe to the event only ONE time, not every time in Update()

prisma crane
#

by subscribe you mean these?

mortal ridge
#

the first

prisma crane
#

okay

#

thank you for the help

jagged wyvern
#

unity REALLY needs to invest in better documentation

mortal ridge
jagged wyvern
#

then why do we keep getting the same questions here

mortal ridge
#

because the api is intermediate i guess. and here are a lot and lot of beginners

#

and tutorial followers

jagged wyvern
#

if we could just refer them to the documentation that would be great

#

but when we do they get confused and need someone to spell it out for them

mortal ridge
#

what do you expect though

jagged wyvern
#

i expect the documentation to be begginer friendly

mortal ridge
#

that would be convoluted and pointless and hurts devs who know what they're looking for

jagged wyvern
#

how

mortal ridge
#

cause that would likely be a lot more words covering the actual important parts

granite apex
mortal ridge
#

you have to add the using statement of course

granite apex
#

I assumed it's a part of UnityEngine.InputSystem. Do I need to specify more than that in using statements?

lost swift
#

Hello! I'm trying to rebind a button in runtime, but getting error "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details."
And nothing happens.

Code was taken from this example - ``` public void StartInteractiveRebind()
{
var rebindOperation = m_Action.action.PerformInteractiveRebinding()
// To avoid accidental input from mouse motion
.WithControlsExcluding("Mouse")
.WithCancelingThrough("<Keyboard>/escape")
.OnMatchWaitForAnother(0.2f)
.Start();

Debug.Log("finished");
#

I need help

blissful comet
#

Workflow question: I have an Input Actions asset for "Hotkeys" to do things like toggling fullscreen, bringing up help, displaying FPS, etc., that are all read by different scripts. Should I have them all spin up an instance of the Hotkeys action map and enable their specific keys, or should I have one singleton with a reference to it that all of these scripts subscribe to?

granite sun
#

I'm trying to port Dani's grappling gun script to the new input system but idk how to go about it. I tried this and it isn't working

      
        if (_movement.Actions.Grapple.triggered) {
            Debug.Log("button pressed");
            StartGrapple();
        }
        else if (!_movement.Actions.Grapple.triggered == false) {
            StopGrapple();
        }
    }```
blissful comet
granite sun
#

isn't the ! supposed to say "not triggered"

#

also the big issue is that im not getting any input at all. the debug.log gives no message

blissful comet
#

Meaning not not triggered

#

meaning triggered

granite sun
#

yeah
void Awake() { lr = GetComponent<LineRenderer>(); _movement = new Movement(); }

granite sun
blissful comet
granite sun
#

wdym by "enable"

blissful comet
granite sun
#

i don't? it's an auto generated script. im confused

blissful comet
#

You have to call .Enable() on it before it reads for input

granite sun
#

huh

granite apex
granite sun
blissful comet
tame oracle
#

people, my input was perfect, now it isn't working... my problem is using a 2d vector, I am using wasd keys... I am able to get input horizontally or vertically, can't use both .. idk why

granite sun
tame oracle
#

can someone help me? what can be the reason? I can't modify the input unless i stop it and can't use the binding on vertical and horizontal axis at the same time

lost swift
rare chasm
#

@lost swift you need to dispose of it because of memory leak issues (important for some reason idk) add an .OnComplete(ctx => { rebindOperation.Dispose(); })

#

Im trying to make rebinding system for my game (like most others here) and am having issues applying said overrides to the controls.

Attached is a screenshot showing overwritten controls, but when i move into using said controls, it uses default controls instead of the overridden ones, despite loading overrides from json

#

anyone know why this might be? i cant find anyone else having this problem online. Using unity 2020.3.26f1. (please ping me)

broken spear
#

Hello, I have a Vector2 action: WASD brings value between -1-0, Touchscreen (Delta [Pointer]) brings value between -100-100. That's why when I receive input, I need to process it accordingly. Is there a better way to tell which device it is? ```csharp
private void OnMovementInputPerformed(InputAction.CallbackContext context)
{
InputDevice device = context.control.device;

  if (device.name == "Touchscreen") // device.noisy is false for touchscreen so cant use that
  {
    
  }
  else
  {
    
  }
}``` Or what I am doing is completely wrong?
olive root
#

So, I am working on collab with someone and the entire input system worked fine for me but not for them, even though the project is perfectly synced.

broken spear
obsidian fiber
#

Greetings, I have attempted to make a movement controller and got all movements except for jumping to work correctly, in fact jumping causes the engine to become unresponsive. Above is a stripped version of the code. I can explain any design decisions if needed, but what would be recommended to create a jumping motion for a character controller object?

eager burrow
#

Is that your IDE??

obsidian fiber
#

no. I took snippets from the code and into notepad to show the code that I have for the most part. I believe the issue I have is math related or maybe another function is needed

uncut depot
#

so is there a problem with making a new InputActionAsset thing for different scripts? or is there a way to reference a Player Input's one thats already there?

#

so for example here, I make a new PlayerControls so i can assign functions to whatever action i have bound. But if I have another script, is it fine to do the same thing? or should i reference the one created already here

thorny osprey
#

Hey! How can you detect left/right click with a pointereventdata but with controller? I guess that pointer event data is only for mouse, which one is for controller and how to get its right click button?

granite sun
pulsar basalt
#

what is left alt called if i want to add it to the input manager?

willow violet
# mortal ridge unity has great documentation

Not for Input it doesn't - docs for Input (and UIToolkit) are terrible, almost nothing is described, most classes are empty, etc. Not true of most Unity, but these two teams seem to have a hatred for letting anyone know how to use the code they've written 🙂

mortal ridge
willow violet
#

Ironically ... when you write the docs that the Input team didn't ... you immediately see some mistakes they made in the design, and which are easy to fix in the code.

willow violet
#

I have a set of large private docs that explain how UIToolkit and NewInput actually work. I have multiple bugs outstanding (and most of them accepted by Unity QA) for the more extreme bitst that I have but they don't

mortal ridge
willow violet
#

If these were documented people wouldn't need to watch lame tutorials by people who were guessing, that lead them to make dumb mistakes

#

No, binding in UIToolkit is a special monster. It is bound at different times. It literally breaks existing Unity APIs - they no longer work, specifically because of the new binding system that UIT introduced.

mortal ridge
#

i recommend not to use binding anyway for in game ui

willow violet
#

Great, but UIToolkit team's response to many game-related UI problems is 'you need to manually bind. No there still aren't any docs for that, just do this [inserts code, that often doesn't compile, because they referenced unity-internal classes]'.

Without docs ... it's no suprrise people get lost 🙂

mortal ridge
#

the thing unity should document more, is ScriptableRenderPass because that one is not really good documented. at least the new version that uses RTHandles

mortal ridge
willow violet
#

Sorry. I'm in a particularly unhappy mood with Unity's docs on Input at the moment, having just fixed more bugs in Input/Events in the last week than I can count on one hand, and most of them 'if you'd written the docs, Unity, you'd have noticed these bugs and fixed them years ago yourselves'. Seeing your comment that Input docs weren't needed triggered me a little 🙂

mortal ridge
#

i didn't say they aren't needed. but getting the input system up and running is already well documented

willow violet
#

Pro devs write docs for their code. Most of Unity has that. Some bits of Unity are decades behind the standard for being a platform provider.

mortal ridge
willow violet
#

Input system up and running is a joke - I logged a bug just last month that creating a new project in latest Unity LTS breaks Input on startup. Because of multiple 'things you need to do but the docs don't tell you'

#

Yeah, sure - Unreal is/was hell. I have bitter memories of Unreal3. That's why I use Unity exclusively these days 🙂

mortal ridge
willow violet
#

Anyway ... TL;DR: I reckon 1 week of Unity Input team writing docs would save them months every year in dealing with support, forums, bug-reports, etc.

#

Docs are good!

mortal ridge
#

definitely. but i haven't had any issues with the docs yet

#

i myself found them just informative enough to be good

jagged wyvern
#

Theyre pretty bad

mortal ridge
#

(╯°□°)╯︵ ┻━┻

willow violet
#

If I had time (I am massively overworked right now 😦 ) I would take my notes and convert to a series of blogposts. There's SO MUCH to explain that is missing

#
  • ... I already started a series on UIToolkit that's had a lot of positive reactions, and I only published the first 4 posts, I have notes to fill another 6+ blogs just on how how to use UIToolkit properly. So Input is way down the list 😦
mortal ridge
#

it really is not hard to figure it out yourself

jagged wyvern
#

They should get someone from the community.
There's so many people that are better suited to describing the unput system than unity is

mortal ridge
#

def not

willow violet
#

"the unput system" 😄

willow violet
# mortal ridge it really is not hard to figure it out yourself

I had to spend days reading the source code, replacing it, proving that it's fundamentally stupid and wrong in multiple places, renaming the wrongly-named classes, wrongly-named methods, to check that they actually do something materially different from what the name says they do, etc.

There is no way on earth that this is acceptable. If you have bad code, or code that changes purpose - fine. That's what docs are for: explaning what the thing actually does, not what the name would imply.

mortal ridge
#

the thing i want in ui toolkit is being able to apply shaders to the meshes generated on generateVisualContent

mortal ridge
willow violet
#

Off the top of my head ... the methods for checking the button state also store the pointer position as a side effect.

#

Reading the code you can see how the method started off doing one thing and probably grew out of proportion (it looks a lot like 2-3 methods that were copy/pasted together, and originally were separate methods)

blissful comet
#

I've got an input asset with different maps for different styles of camera movement on different Action Maps. Many different scripts will reference this action map. Previously, I had code similar to this on things that use it. This would mean that each script spins up an entire new instance of this input asset whenever something needs it, and that feels wasteful. Ideally, I'd want to have one Input asset that everything uses and just enable/disable maps as needed, right? Is the best way to handle this using a singleton MonoBehaviour with a reference to the input asset that other stuff can use to access that asset and subscribe to events, or is there a better way that's a better practice for use with the Input System?

foggy notch
crisp smelt
#

Except I tested the latest Input System package (1.3.0, Unity 2020.3.14f1) the bug is still there.

#

Unless I'm blind I can't find anything else on the page that says anything about which version it was fixed, nor can I find it in Input System package changelog.

crisp smelt
#

That's also the latest version there is, unless I'm missing something.

random siren
#

i changed my method of player movement from translation to addforce and now this setup can make the player continually spin on the spot? is triggered when i walk into a corner of a box, can be resolved by walking straight forward into a wall

mint blaze
#

Hi, I haven't ever used the new input system. I just wonder if it has some implementation that later allows to implement control settings. That would be a game changer for me.

austere grotto
mint blaze
#

well, keybindings

#

like to change the crouching key

#

from c to ctrl and vice versa

austere grotto
#

yes the new system supports key reybinding at runtime

mint blaze
#

okay, that's all I needed to know

mint blaze
#

The ToJson and FromJson() functions are super helpful

crisp smelt
austere grotto
#

yes

crisp smelt
#

Cool, I'm going to browse through the commits

#

But from a brief look I can't find the case # or anything that immediately seems related.

#

Yeah can't seem to find it being fixed 😔

#

Well that's disappointing, guess I'm not using Input System until maybe 5 more years.

blissful comet
#

How would I make an Input Binding that fires an event every frame that the button is held? Because it is apparently not this.

austere grotto
blissful comet
austere grotto
#

Ah - you can't

blissful comet
#

Dang

austere grotto
#

Just poll it

blissful comet
#

Making a bool and checking it in Update just seems antithetical to what the Input System wants to be so it felt like a janky workaround

austere grotto
#

Yeah I would avoid events at all for that use case

#

just myAction.IsPressed() in Update

blissful comet
austere grotto
#

If you are using an earlier version you probably have to do myAction.ReadValue<float>() != 0

blissful comet
#

Huh, mine only has 1.0.2, maybe it's not available for my Unity version? I'm stuck on 2020 for the time being, 2021+ breaks some necessary plugins

#

I'll try readValue

reef valley
#

Why doesn't my player get affected by gravity using the new input system??

austere grotto
#

The input system merely gives you a way to read input data.

reef valley
#

Ah okay thanks, I ssee the poroblem ^^

dense cedar
#

I'm trying to create a slider that allows for changes in the on-screen stick's "Movement Range" using a slider. I'm guessing that I don't want to edit the auto-generated script from the (new) input system, so I need to access that field externally. The slider works fine and a value gets stored in PlayerPrefs, but I need to tell the 'stick' to use that value. Any suggestions?

#

The value I'm trying to get at is here.

#

Specifically, that "movement range".

austere grotto
#

For something like "sensitivity" I'd imagine you want to change the effect that the stick has on something in game, no?

dense cedar
#

Good question. I want to change the sensitivity of the touchpad on mobile.

austere grotto
#

yeah you wouldn't touch movement range for that - that'd be some value you multiply into your movement calculation in your code

#

or I guess - rotation calculation?

dense cedar
#

My game allows a player to scroll their character side to side (also forward a back to a lesser degree) but some complain that the response (sensitivity) of the pad is insufficient on mobile.

austere grotto
#

Yeah exactly

#

that'd be something in your movement code

dense cedar
#

I can alter the side to side movement speed well enough.

#

If that's actually what players are looking for.

austere grotto
#

unless you have some kind of acceleration built into it - that speed seems like the only thing they could be talking about, no?

dense cedar
#

I suppose that makes sense. They probably want to be able to shift directions (left to right and back) more quickly, not change how the pad responds.

austere grotto
#

I guess in some sense making the stick movement range smaller could be thought of as making it a bit more responsive, because then their finger has to move less distance to manipulate it

#

But I kinda doubt that's what they mean

dense cedar
#

@austere grotto , thanks for the pep talk. :0(

#

🙂

rancid fractal
#

Hey, how can I control cinemachine via touch?

rare chasm
rare chasm
#

ayo nevermind i figured it out, instead of adjusting the generated c# class i instead was adjusting the playerinput component

faint horizon
#

okay so i am using the new input system (using unity XR so it was reccommended to use the new input system) as you can see in the image attached i add the input events but whenever i touch my right stick (in any direction) there is no movement/change in the cameraYOffset in the XROrigin.
my code is here: https://github.com/walksanatora/My-VR-project/blob/master/Assets/Scripts/verticalAdjustment.cs

GitHub

Contribute to walksanatora/My-VR-project development by creating an account on GitHub.

lost swift
#

I have to dispose Action?

faint horizon
real crystal
#

New input system, behaviour is invoke unity events so normal code for functions is

#

public void Empty(InputAction.CallbackContext context) { GetStateFromInput(EmptyInput, context); }

#

however, it seems like this stops me from using buttons in the UI to call those same functions since presumably they don't send callback contexts (I notice that one of the control functions that are public doesn't have any parameters so it comes up in the inspector while none of the other functions do)

faint horizon
real crystal
#

Sorry MB, this is my own question, no relation to yours

viscid garden
#

Happens in build and in editor.

#

I think the issue here is that when im pushing my controller right stick into a certain direction, I no longer receive input events because my stick isn't technically moving anymore. It's being pushed all the way in one direction and not technically being moved anymore.

#

How would you guys tackle this? My first thought is using a flag maybe so that as long as the right stick isnt 0,0 it'll move in the last direction that was registered?

royal oyster
dapper prawn
#

Could there be a general reason in why when we play a scene... The player controller works in one computer and not the other? The input settings seem to be the same on both computers. It is a First Person Controller

pale jacinth
#

TL;DR Single scroll returns a value of (0, 0) I have to give it about 3-4 scrolls for it to return (0, ±120)

Hey there, I have an issue with reading the scroll value with the input system. I am using the default input actions and I'm listening for a scroll event. The callback is called correctly when I scroll, but when I use ReadValue on the context object it returns (0, 0) as the value. I have to give it about 3-4 scrolls before it registers a non zero value for y. I checked and there are no processors or interactions on the action. Also I checked to see if my mouse is Ok and it is, on the unity editor a single scroll does work both on the viewport as on the inpector panel. Using a trackpad to scroll does work correctly.

vivid junco
#

if you map the controls as a switch pro, will you still be able to play the game with joy cons?

delicate pollen
#

Attempting to get a constant 'true' if I double-click and hold the left mouse button...

[HideInInspector]public bool        MouseLDoubleHeld=> controls.BipedMovement.MouseLeftClickDouble.WasPerformedThisFrame();

Currently it's not working for me (nothing detected when I seek it in Update).

if (iC.MouseLDoubleHeld)
        {
            Debug.Log("Double click detected.");
        }

Any clues?

untold gulch
#

There's no need to mark that with HideInInspector btw

#

Unity won't serialize properties

delicate pollen
#

Ah, useful! Thank you. =)

#

Any ideas on the Double-Click-Hold, @untold gulch ?

untold gulch
#

Unfortunately not, I would have provided some info if I did :(

#

Hmm, have you tried WasPressedThisFrame instead?

delicate pollen
#

Aha, no worries - removing HideInInspector has cleaned up my input script nicely, thanks. =D

delicate pollen
#

It's odd. I'm getting an input if I do
public bool MouseLDoubleHeld=> controls.BipedMovement.MouseLeftClickDouble.WasPressedThisFrame();
but it doesn't seem to be taking into account the Multi-Tap...

#

I only have to click once to trigger the input.

austere grotto
untold gulch
#

That's effectively what WasPressedThisFrame does (to an extent), just less efficiently (since it would allocate closures)

#

Rather strange that it doesn't take the multi-tap into account though

austere grotto
#

nah

#

WasPressedThisFrame will only return true for a single frame

scenic orbit
#

Anyone know why several inputs on bluetooth Xbox one Controller

#

don't work on Mac/Unity

#

using old Input system.

austere grotto
#

Is there a Quaternion control type?

#

How did you set up the input action?

austere grotto
#

What did you bind that to?

#

show the input bindings

#

open it

#

show the bindings

#

That No Binding seems possibly wrong

#

I've never worked with XR framework so not sure if the other bits are right

#

See if deleting the empty binding helps?

#

save your project

#

commit

#

try it

#

if it doesn't work, rollback

#

You are using version control, right?

#

last thing to check is make sure that you've enabled this thing?

austere grotto
#

whatever ActionBasedController is

#

did you enable it?

heavy acorn
#

Hello, I wanted to make some kind of way to get input from the keyboard for my console on this laptop in the game. So I created an Inputfield that is automatically selected when the console is activated. It works but I always have to press enter or mouseclick again after I submitted the text. How can I automatically reselect the InputField after submitting?

#
public class KeyboardInputController : MonoBehaviour
{
    // 35
    public InputField inputField;
    public Controller controller;
    public TextMeshPro console;

    private void Update()
    {
        if (controller.consoleMode)
        {
            inputField.Select();
            inputField.enabled = true;
            inputField.readOnly = false;
            inputField.interactable = true;
            if (Input.GetKeyDown(KeyCode.Return))
            {
                console.text += inputField.text;
                inputField.text = "";
            }
        }
    }
}
#

as you can see I already tried to set some booleans and calling the select method but nothing worked...

terse aurora
#

you fellas know what the terms for more than and less than are?

lost swift
#

Hello! I trying to rebind some buttons, for that i disable action, then start rebinding

void RemapButtonClicked(InputAction actionToRebind)
    {
        var rebindOperation = actionToRebind.PerformInteractiveRebinding()
                    // To avoid accidental input from mouse motion
                    .WithControlsExcluding("Mouse")
                    .OnMatchWaitForAnother(0.1f)
                    .Start();
    }

i also have void inside RemapButtonClicked for dispose and clear button on cancel or oncomplete, but still have "A Native Collection has not been disposed", what can i do to solve this?

mint blaze
#

Hi, I am using the Player Input component. I'm using the broadcast method of handling inputs. It works as it should, when I hold down r it does what I want. But I also want to know when the button is released and send another broadcast. How do I do that? I've tried finding a solution with no luck.

gleaming oar
#

.performed and .cancelled

austere grotto
#

Unity events mode will fire an event for cancelled

tame oracle
#

found it

steel yoke
#

Is it possible through unity's action-based vr controller to grab your own hand and throw it?

austere grotto
#

Anything is possible in the world of video games!

steel yoke
#

hmm yes but how. I think I'm going to cheat and make a duplicate game object that is throwable.

austere grotto
#

Seems reasonable

#

I don't think throwing one's actual hand would be a great user experience

dapper narwhal
#

lmao

wet vortex
#

My input seems to stop working when I pause the game, how can I make the input unscaled?

#

Solved: Changed update mode from fixed update to dynamic update in project settings

thick pollen
#

Hello, I have a strange issue with the input system. When I'm pressing Z on my keyboard to move forward, the character does not move, but he moves forward if I press W. I have checked my keyboard is not in a "qwerty mode" (i'm an "azerty" user"). Does anyone have a solution for this problem ?

thick pollen
#

Even if I try to switch between the AZERTY and QWERT mode, I can only press on W to move forward

crimson crater
#

For some reasons unity throws me an error when I use this despite the fact that it worked perfectly before GetComponent<PlayerInputManager>().JoinPlayer(0,0,"Host",Keyboard.current,Gamepad.current);
"Says Value cannot be null"

#

fixed it

karmic umbra
#

Hi, how do you simulate Input.GetButtonDown() in the new input system?

Edit: I figured it out, if anyone was wondering you can use WasPressedThisFrame()

olive root
#

So, uhh, the performed actions aren't called on my device, but everyone on my team can call them just fine, does anyone know what causes this?

warped dock
#

Hey question:

I declared these too and dragged an input field to the first one.

#

Later i created this function:

#

And i added it in " On End Edit (String)" but it doesn't store the string i am input in charName

#

Can anyone help?

austere grotto
rapid saddle
#

I'm using the Right Trigger on a Gamepad to control the throttle of a car. For whatever reason, the value never goes back to 0 after I let off from the trigger.

void OnThrottle(InputValue value)
{
    throttleValue = value.Get<float>();
}

Why is that?

fleet pasture
#

Is there a function in the new input system like GetButtonUp()? I'm trying to make a player controller and jumping feels weird when it's not as I release it.

austere grotto
#

or subscribe to the canceled event

fleet pasture
#

ok I'll try it out thanks!

fleet pasture
#

I tried to get that working but all that works for me right now is my:
playerActions.Land.Jump.performed += _ => Jump();

#

And that just performs the action as soon as I press it

austere grotto
warped dock
austere grotto
#

It's a bug in your code

warped dock
#

I store the value this way

glass yacht
#

that's an empty string

austere grotto
austere grotto
warped dock
#

I store the input text in charName

#

wait

glass yacht
#

and you're printing characterName

#

the InputField

warped dock
#

I changed characterName to charName. Now it justs prints void

glass yacht
#

Ignoring what we say is not helpful

warped dock
#

Yeah, i changed characterName to charName first, hoping this was my error and i tried to choose a function from the dynamic section later

#

It worked

#

Thank you!!

next bloom
#

Is it possible to use Letterboxed area for mobile? I'd like for the player in the game to move even if I have input in the letterboxed area

stable coral
#

So I have an issue with my input using Axis. For some reason it reports 0 AND some value (e.g 0 and -1) and I have no idea why

#

since it's a float it couldn't possibly have 2 values at the same time, although I'm unsure

austere grotto
#

It's not two values at the same time

#

it's one at a time

#

Second share the code that's printing this

uncut creek
#

trying to get main menu navigation working for both mouse&kb and gamepad. I have an event system with the InputSystemUIInputModule and a MainMenu object with a PlayerInput component on it with the eventsystem selected as the UI Input Module.

It works for whichever input scheme I select, but will not switch from mouse&kb to gamepad or vice versa if I use <any> as the default scheme.

I am using a custom input action asset with generate c# class. Is there a way I can use my custom class to send info to the event system in the same way as PlayerInput? or am I just missing a setting somewhere possibly?

#

hm. seems like all I needed to do was ditch the PlayerInput component entirely, and create and enable my custom player input from within my menu script

#

🪄

blissful comet
#

Is there a way to know what the most recently used input device is? I'd like to update glyphs from keyboard to gamepad based on what they most recently used

gleaming oar
#

there's a few hacks people have in there to get it, but nothing really built in

blissful comet
#

Dang. I found that thread too but they all seemd kinda like janky hacks and I was hoping there was something more built-in

fleet pasture
#

I'm setting up local multiplayer and I have a controller and the multiplayer set up. But for some reason my inputs controls all of the players. I'm using input actions in my script instead of unity events and couldn't find any resources that stated how to fix this. Please help, thanks.

real berry
#

Does anyone here experience key presses getting "stuck". i'd say quite often presses gets sticky and i have to press it again so that Input.GetKey stops returning true.
(UPDATE) it looks like there is a fix and it's macOS related. need to update to a newer version of unity

tame oracle
#

what is the GetButtonDown() equivalent in XR input system?

#

im trying to activate a grabbed item (checking if its grabbed or not is irrelevant rn, ill do that later, for now i really need to be able to use the input on an if statement)

coral flame
#

unity is trash

#

its just randomly broke out of no where

mint crow
#

?

coral flame
#

like files are not decompressing and it gives me weird coding like someone had deleted a core file that just breaks

random edge
atomic silo
#

hi guys

#

did anyone experience touch lag on Android?

#

seems that I'm not the only one

#

unfortunately no answer

#

I tried with old and new input system

#

during few seconds after the game launch, touch is very precise

#

exactly what I need

#

then it starts to lag behind

#

like on the first video from the link

#

is there a solution to keep it precise all the time?

stable coral
#
    private void Update()
    {
        PlayerThrottleJoy(plr_setup.thrustJoyAction.ReadValue<float>());

        Debug.Log(plr_setup.thrustJoyAction.ReadValue<float>());
    }
austere grotto
stable coral
#

alr hollon

austere grotto
#

ok that confirms it all comes from one instance of the script at least

stable coral
#

even if one says 92 and another says 82?

austere grotto
#

oh shit good eye lmao

#

then yeah it's two different script instances

stable coral
#

Oh im a dumbo, i have 2 players and both of them share the same script