#🖱️┃input-system

1 messages · Page 18 of 1

pallid notch
#

How can I make a simple true or false with the input system? It would basically be input.GetKeyDown.

austere grotto
#

not recommended though since you cannot rebind it

#

you should use input actions

pallid notch
austere grotto
#

Just find/follow tutorials for getting started in the new system

hard nimbus
#

any benchmarks about inputs, systems, event system, unity event, getkeychar, and other selectable soultions, message que all devices cpu costs?

sudden helm
#

I’m creating a first person controller with the input action system. I’ve got everything working with gravity, movement, jumping, and sprinting. I’m happy with it but the sprint action(shift) works for all WASD keys. Isn’t it standard to just have W and Shift as sprint? Can anyone shed some light on how I should approach this, whether in the Input Action controller or in code. Right now I use OnSprint to toggle a bool to set sprint speed, if that helps. Again, very new to the input system, so appreciate any help

austere grotto
#

Just have Sprint be a separate action

#

in your movement code you can easily have somthing like:

if (movementInput.y > 0 && sprintAction.IsPressed()) {
  speed = sprintSpeed;
}
else {
  speed = normalSpeed;
}```
sudden helm
#

Thank you!

austere grotto
#

or e.g. Mathf.Abs(movementInput.x) < 0.1f

sudden helm
#

Perfect everything works. Thanks again @austere grotto

ember wind
#

I'm trying to use the on-screen stick on an android mobile. It does work in the editor perfectly, but it does not work in an android build, even though I can see the joystick moving and being pressed

#

Any ideas what I'm doing wrong?

#

I updated the input system package

#

now it does not work at all lol

minor pebble
#

Is the "new" input system very useful for a one button game where the time around the pressed button and other stuff related to the position of the character in the level ?
Or should i just keep the default stuff

austere grotto
#

same as the benefits of the input system in any game.

minor pebble
austere grotto
#

there are several approaches

minor pebble
#

ok ty

sharp valley
#

how do i make a local multiplayer in which players are controlled using a single keyboard

quiet tusk
#

so this happens when i click generate c# class from the editor

austere grotto
#

the errors?

idle trail
#

Question. With InputActionMap for fields. If I assign a custom generated ActionMap to it, is there a way to get my custom map or verify that a specific custom map was assigned(so I am not trying to pull values that aren't there?

austere grotto
idle trail
#

InputActionAsset

#

Cannot implicitly convert type 'PlayerActionAsset' to 'UnityEngine.InputSystem.InputActionAsset'

austere grotto
#

that returns the wrapped InputActionAsset

#

or perhaps .asset

#

forget what it's called

idle trail
#

InputActionMap has a .asset, but still I can't assign that to a PlaterActionAsset

#

I am pretty sure that just gets the InputActionAsset related to the map. And I can't convert InputActionAsset to PlayerActionAsset

austere grotto
#

PlayerActionMap is a convenient wrapper around an InputActionAsset with nice names

#

that's all it is

idle trail
#

So I can access actions by string with InputActionAsset, but by fields with the generated PlayerActionAsset. (forget the map part, that was just terminology messing me up).

I can assign an InputActionAsset through the editor, but not a PlayerActionAsset.

I need a way to turn InputActionAsset into the PlayerActionAsset.

#

Currently I just am adding A static service field since the generated ActionAsset script class is partial.
Maybe assigning it through editor is just the wrong approach as it isn't like the normal InputActionAsset, and won't have multiple versions.

austere grotto
#

Basically you'd have to make this writable

#

and/or assigned in a constructor

idle trail
#

Yeah, just calling a static reference works for now.

idle trail
#

I am trying to use ReadValue<Vector2> to get the mouse position each frame. But it is only returning the same value over and over. Can you not get it like that, and only through the delegate?

idle trail
#

Okay pretty sure it just isn't getting the mouse position properly. Not sure how to fix that

austere grotto
idle trail
#

{"x":0, "y":1, "z":-10}

#

or

#

[0, 1, -10]

#

is all I am getting

#

Tried both virtual and non-virtual mouse position

#

Also tried ReadValue and Performed

#

Restarting Unity as sometime that helps

#

And my dislike of the new input system continues...

austere grotto
idle trail
#

Read my messages

austere grotto
#

I just see "mouse position"

#

nothing about virtual mouse

austere grotto
#

but you said "none" so I thought you meant you bound it to nothing

idle trail
#

Ah see the confusion

austere grotto
#

you want either Mouse position or Pointer position

idle trail
#

I tried Pointer position also, same thing

austere grotto
#

debug the actual input value

#

ScreenToWorldPoint is giving you the camera's position {"x":0, "y":1, "z":-10}

idle trail
#

Ah good catch

austere grotto
#

because you're using a perspective camera

#

and not providing a z distance

idle trail
#

well, that isn't the only issue.
Debugging the read value just is giving {"x":0, "y":0}

austere grotto
#

which which binding

idle trail
#

Mouse.Position

#

Is just deleted the Action and redid it and now it is working.

quiet tusk
austere grotto
#

Show one example

quiet tusk
#

everything in red, im just curious why it generated like that

#

sec let me show a tooltip

austere grotto
quiet tusk
#

well there are many but here is the first

Assets\InputControls\PlayerActions.cs(518,19): error CS0542: 'PlayerActions': member names cannot be the same as their enclosing type

#

Assets\InputControls\PlayerActions.cs(520,32): error CS0523: Struct member 'PlayerActions.PlayerActions.m_Wrapper' of type 'PlayerActions.PlayerActions' causes a cycle in the struct layout

austere grotto
quiet tusk
#

the PlayerActions C# script is whats generated. are you telling me I just need to change the asset name ?

austere grotto
#

I think you might have hit a weird edge case in the code generator

#

it probably takes your Action Map name "Player" and adds "Actions" to it to create the name of a struct holding its actions. So it ends up naming something PlayerActions which happens to be the name of the asset itself

#

hence the naming collision

quiet tusk
#

so renaming it worked. it generated the same name of the asset again but no errors

#

thanks

light silo
#

New project and suddenly NIS isn't working. I'm using is just how I have in the past but suddenly it's not working. It's enabled properly, I've tried public methods, NIS does recognise input through the input debugger just not through the actual game. Any clue what's going on. Same version of unity as projects with working NIS, just new projects have this issue.

austere grotto
#

I notice you have a scheme just called "Control scheme"?

light silo
#

Oh? Schemes are new to my knowledge, I didn't remember interfacing with them before. Do they need to be named in certain ways?

quiet tusk
austere grotto
light silo
#

Player Input and script are on the same object

#

Huh, okay then.

light silo
#

Thank you!

fringe condor
#

Is there a way to detect if the application is running on a device that supports touch?

versed venture
# fringe condor Is there a way to detect if the application is running on a device that supports...
#

Just use google man. It's the first link that popped up and already solves it

fringe condor
#

and it's not what I want

#

don't judge what someone wants before you're sure

#

this is not compatible with the new input system

#

SystemInfo.deviceType is also not compatible with webgl

fringe condor
versed venture
#

or webgl

fringe condor
#

btw we're in the input system channel? did you notice?

#

I wouldn't be rude if you wasn't rude first

versed venture
tulip tartan
versed venture
fringe condor
#

"just google" sounds rude to me because that's my everyday job as a developer

tulip tartan
fringe condor
#

anyways, I found a way to solve the problem

#

I can do InputSystem.GetDevice<Touchscreen>() and check if it's there

versed venture
tulip tartan
versed venture
#

In my ears you basicly asked "How can I eat".
I answered: "With your hands"
The reaction "I'm eathing soup, I'm not going to eat soup with my hands."

fringe condor
#

just forget it

versed venture
#

I didn't know you used webgl or used the new input system.

fringe condor
#

I should've just ignored you in the first place

tulip tartan
fringe condor
#

I'm too busy for that

versed venture
# fringe condor I should've just ignored you in the first place

sheez. I just tried to help. A lot of beginners ask in this server before googling, cause it gives more direct answers. A lot of beginners (who use the old input system) think that this is the place to ask a question.
I didn't know you were an everyday developer. Sorry if I sound rude in your ears, but I wasn't.

Like someone would ask "Can I get some help" and someone send the "dontaskjustask" link. That isn't rude at all. Just giving advice what they should do.

And yes Aethenosity. I'll shut up now. Even though you're not a moderator

fringe condor
versed venture
versed venture
#

And now it's fixed can i shut up

#

So that means that you can also stop reacting to my messages. If you wanna say smt, then do it in #💻┃unity-talk or via dm

tulip tartan
#

<@&502884371011731486>

keen elm
#

I have two functions (https://hatebin.com/zrakphakzc) that are very similar and both rebind controls but the one thats supposed to work for composites(the second one) dosent run the On complete part of the PerformInteractiveRebinding but the first function runs perfectly fine.

jovial elbow
#

Hi guys, I've set up my player this way (https://paste.ofcode.org/zRB768qdpGbt4hButptX56) but for some reason I can't figure out why there is no way the event .started calls the DoBuzzle function even if everything seem to be assigned correctly in editor and in game.

austere grotto
pine canopy
#

Hey guys, im using the new Input System.

Let's say I have an Action called "Jump", and underneath, I set it so that on keyboard, spacebar is jump, and on controller, X is jump, etc.
How do I find, in code, find out what key is to perform "Jump"? Given the device I'm on

#

I got to the point where I can print out:

"<Keyboard>/Spacebar"
"<GamePad>/X"

#

But given that, is there no easy to just check:

if (this running device matches the first part of that string), then use "Spacebar", etc.

#

I feel like having to do some heavy string manipulation of splitting those strings by "/", and then trimming the "<" and ">" and then STILL comparing the "keyboard" string to detecting if a Keyboard is plugged in, all feels like messy code.

#

My aim here is that:

if player approaches a treasure box, it says "press Spacebar to open" or "press X to open" based on device automatically.

quiet tusk
pine canopy
#

Oh I don't need to worry about player setting the layout, i dont let player change the controls mapping in this game.

#

I just want to be able to see "press {key} to Interact" without checking if ("keyboard" && device.Keyboard == true) for example.

#

Is that really the cleanest way?

#

There's no way Unity released such a big Input System feature, and everyone brags about it, but such a common feature, seen in literally every game, is not easy to do

#

We know Unity can detect device, cause as soon as I plug in a GamePad, X is now jump.
So if Unity knows which devices are plugged in,

#

why can't I just ask like string = "Press " + player.Input.Interact.key + " to Interact!"

#

And that variable in the middle is whatever button is mapped to Interact based on the current device active.

#

Unity should just give me "Spacebar" if keyboard is detected, or it should give me "X" if GamePad is active.

quiet tusk
#

sorry i dont mean a layout like changing the controls, im just saying that if a game pad is detected to just default to using that terminology

pine canopy
#

Why do I have to detect if a GamePad is plugged in tho?

#

Do we, developers, have to detect if a GamePad is plugged in when we decide X vs Spacebar to perform Jump? No, Unity's InputSystem does

#

on the InputSystem Mapping menu.

quiet tusk
#

i see what you mean now, you mean regardless of what device consumed the action you want a clean way of knowing what device it was

pine canopy
#

Yes, I just want Unity to tell me what to display based on Unity knowing what device is being used

#

If I have to do the whole:
If (device == keyboard)
// code
else if (device == gamepad)
// code
else if (device == mouse)
// code
else if (device == something else)
// code

#

If we have to do this ^ messy thing, then that's not good.

quiet tusk
#

but, if you are showing a message like "press X to open the chest" is assumming no device event has been triggered yet

pine canopy
#

Yes, cause I am telling Unity I want to know the key for Interact action.

#

If you see the image above, I have either E or Select

#

but can't Unity tell me to display the one, of the device, that was most recently active?

#

Basically, if this new Input System by Unity is good, I should just be able to do this:
string = "Press " + player.Input.Interact.key + " to Interact!"
and Unity should, in that variable 'player.Input.Interact.key' just replace it with 'X' or 'Spacebar' depending on most recent active device, or active device.

quiet tusk
#

for me, i wouldnt expect unity to figure out which key to use if you havent told it what to default to

#

when there are multiple bindings

pine canopy
#

Does Unity not know what device is active?

quiet tusk
#

i believe to do what you are looking for is to use control schemes and listen to device changes. but to me that is overkill if you are only really looking for changes between gamepad and keyboard/mouse

pine canopy
#

But how is Unity System all that modern if this messy way is the best way?

#

And in the future, if I add another device as support, I have to not only modify the InputSystem action map

quiet tusk
#

There may be some better way that I do not know of atm, someone else may have some better input (pun intended) on this

pine canopy
#

but ALSO, all the places I have this messy if-condition in

pine canopy
keen elm
# pine canopy This is messy to me, and also repetitive, and devs would have to come back and c...

you may need to go back a little but here https://youtu.be/Yjee_e4fICc?si=nNqgqT2_i2xHUefN&t=1474

✅ Get the FULL course here at 80% OFF!! 🌍 https://unitycodemonkey.com/courseultimateoverview.php
👍 Learn how to make BETTER games FASTER by using all the Unity Tools and Features at your disposal!
👇
🌍 Get my Complete Courses! ✅ https://unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.
🎮 Get my Steam Gam...

▶ Play video
jovial elbow
keen elm
tame oracle
#

i subscribed my toRun action as seen here in the start() function but when i press the ToRun button i get no input registered. Why?

jovial elbow
#

Local multiplayer input system

formal girder
#

When having the same key on different action maps how does the rebind work? So for example Action Map A has a action with the "M" key and Action Map B has also the "M" key. When rebind the "M" on Action Map A to "N" does it work automatically for Action Map B aswell?

amber wigeon
#

hi, i made some little code, and it works only when the Point action is in Movement action map, and doesnt work when it is in the Grapple action map. i think it may be caused by the Movement action map set as the default map, how do i force the game to use both action maps?

austere grotto
austere grotto
amber wigeon
feral flame
#

Hi everyone, I have player Input component attached to my player which is taking a Xbox Controller scheme by default at runtime, it’s not detecting my keyboard and mouse.
Can anyone help me resolve this?

sterile citrus
# feral flame

It says Keyboard/mouse is the default.

Also it would be a lot more helpful if you used the screenshot functionality on your computer. People really hate seeing phone photos because it looks unprofessional and it makes it less likely for you to receive help.

calm brook
#

Hi, is there a good way to share a canvas like a character roster screen in a local multiplayer setup where each controller has a virtual cursor ?
Like in Super Smash Bros. Ultimate.

calm zinc
#

Hi, I'm trying to use the input system to get the camera to orbit my character. I want to basically use a click and drag to move the camera, but I want either mouse button to work. For each binding, I'm using mouse delta with a mouse button modifier. When I have only one binding, it works as expected. However, when I have both bindings, only the second one works, and the first stops working. Am I misunderstanding how multiple bindings work? Any help would be appreciated.

austere grotto
#

This is too cute by half

supple crow
#

I would expect it to work fine, though.

#

Oh wait, I misread that

#

but I'd still expect it to work. Maybe the second one consumes the mouse delta? I'm not sure how that works...

celest siren
#

does anyone know why it isnt working?

austere grotto
tulip tartan
sonic sageBOT
tulip tartan
#

It is not configured either

celest siren
tulip tartan
sonic sageBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

celest siren
tulip tartan
tulip tartan
tulip tartan
#

It seems like it should work.
I don't think this is the issue, but do you have any rotations constrained in the rigidbody component?

celest siren
#

that i should set the y to 0?

austere grotto
celest siren
austere grotto
#

so none of this code is going to affect it

#

you've made it a separate object

#

you should probably see how the tutorial did it

#

and follow that

tulip tartan
# celest siren do you mean this?

What Praetor said is the issue, but no, I meant the rigidbody component which is right above your MouseInput component on the Player object.
But that is irrelevant now

celest siren
tulip tartan
austere grotto
celest siren
tulip tartan
celest siren
#

this is the one inside cameraHolder

austere grotto
#

so of course it won't rotate

tulip tartan
celest siren
celest siren
austere grotto
# celest siren like this?

also the CameraPos object is not even being rotated according to what you've shown either.

I don't see why you need this proxy layer

#

just make the camera a child. There's a reason you have an object called PlayerCam

#

that should be the camera

#

Are you trying to mix two different tutorials or something

celest siren
austere grotto
#

My recommendation is just to start the tutorial over and follow it more closely

#

you seemingly have just done things differently from the tutorial

#

and therefore it's not working

celest siren
# austere grotto you seemingly have just done things differently from the tutorial

https://www.youtube.com/watch?v=f473C43s8nE i really dont think that i did something wrong to be honest

FIRST PERSON MOVEMENT in 10 MINUTES - Unity Tutorial

In this video I'm going to show you how to code full first person rigidbody movement. You can use this character controller as final movement for your game or build things like dashing, wallrunning or sliding on top of it.

If this tutorial has helped you in any way, I would really appreciate...

▶ Play video
#

but ill watch a different one

tulip tartan
#

If you are going to something else, I strongly suggest not using youtube

#

Use unity learn first, then move on to YouTube

!learn

sonic sageBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

celest siren
tulip tartan
tame oracle
scenic knot
#

does there anyway to detect which device connected to pc in Unity with new Input System? Like keyboard, dualshock or xbox gamepad?

tame oracle
supple crow
#

You need to switch the Navigate action to "Value" mode from the "Pass-through" mode. Since the default action asset comes from the Input System package, you'll need to make your own copy (or just copy the UI action map into your own asset)

#

I just learned about this and oh my god it was so annoying

#

let's spam some keywords for the search: steam deck d-pad, d-pad steam deck, steam deck, dpad, d-pad

sacred lichen
#

Hey guys, quick question. does anyone know how to WRITE any data on an existing input action for the new unity input system?

#

I want to make a FixedTouchField for my mobile and pc fps controller but I can't find how to write a value(for this case a vector2) inside one of the existing input actions called Looking

supple crow
#

Using the new input system, I want to let the player use the d-pad to navigate a menu whilst still using the joystick to control their character.

#

Both the joystick and the d-pad are bound to the Navigate action

#

and the EventSystem is using that action for navigation

#

I guess I need to make a separate action, and then switch which one the EventSystem is using?

supple crow
#

Maybe I can just disable the joystick binding, but that looks a bit icky

stark notch
#

I am currently using the old system for quickly setting something up but i was wondering where i can find a document showing all axis and which one i need to select for the right joystick horizontal and vertical movement

stark notch
#

i found it

#

need to use x axis and y axis joystick number 1 or 2

#

only need to figure out the correct way to set my deadzone cause it doesn't seem to work properly currently

stark notch
#

ok so i figured out the sensitivity and all that it works fine with a joystick but it's not the correct one

#

i right now have the left one working and it can rotate my camera around etc but i actually want it to be the right one doing this

#

i have tested all 16 and none of these is connected to the right joystick anyone know how to do it?

tawdry heart
#

How can i check if an InputActionMap has a specific processor?

#

i have a rebinding system that generates multiple ui fields for each input action inside a map, but some inputs i dont want to be rebindable (such as Escape for pausing). I thought best way to implement this was with a processor that did nothing and was only for marking the action to not be rebindable

#

all i see however is the processors property, which retuurns a string

austere grotto
#

Either with InputActionReference or just a string name or something

tawdry heart
#

because i dont want to spend time filling that list and updating it if i add a new action

#

regardless, the protperty just returns the name of the processor, so i just compared strings and called it a dday

gloomy gorge
#

is the Input System Actions package broken or is my install borked? because in every dialog like this it tries to show a search bar on the top, and I can't click on any item

gloomy gorge
#

just noticed that it's also creating this warning

chrome mirage
#

you can still pick them with arrows on keyboard

gloomy gorge
#

aw! got it x3

stark notch
#

yeah i think it switches the two mouse buttons around i can always select it with the right one instead of the left one when it happens

#

this bug has been here since the 2022 version

fickle parcel
#

I'm implementing the new Input System on my camera controller script but I get a jittery look movement, how can I smooth it?

#

I just solved it by adding a scaling preprocessor on the inputaction and scale the vector of something like 0.1f

old mason
#

Is this supposed to be grayed out?

#

And how to block clicks under GUI objects but not on the terrain, 3D objects etc.

uncut swift
#

I'm setting up the new input system for the first time and I have some questions.
I'm making action maps for each state the player can be in. mainly exploration, combat and UI and I turn these action maps on and off from my state machine.
combat and exploration are close to identical in the actions they have but with some differences.
now that I'm making my player movement script I'm not sure if I need to subscribe to both the Exploration.Move and Combat.Move or if there's a better way to do it.

old mason
#

I can't get a mouse click event to fire no matter what I do.

#
    public void OnClick(InputAction.CallbackContext context)
    {
        Debug.Log("OnClick fired");
}
#

Why is it never firing?

austere grotto
#

PlayerInput is completely unrelated to the input module

#

Also a bit confusing that you named your actions asset "PlayerInput"

#

But you'd have to also show how your asset is set up

old mason
#

I got it to fire, I had to add devices apparently, but now I have a worse problem that I can't detect if player clicks GUI or not

marble flare
stark notch
#

in the new input system the gamepad sticks are not yet delta time affected right?

flat jay
#

Hey I have a question I will rework my game for the new Inputsystem ..

        m_Vehicle.SetSteerInput(Input.GetAxis("Horizontal"));

How do I get this float Value ?

#

Is this correct ?

stark notch
flat jay
#

ty!

#

I have looking for float value ^^

austere grotto
#

If you want to translate that to movement per frame _ or something, some adjustment will need to be done at some point

#

But it would make no sense to do it at the input level

stark notch
#

yeah, it's for my camera rotation to apply delta time so that it is consistent

austere grotto
#

For example if you wanted to use it to set a velocity it would be counterproductive to premultiply DeltaTime

stark notch
#

just trying to figure out how i can best do a check for which device is giving input to apply delta time only when needed

austere grotto
#

You mean like mouse vs joystick

stark notch
#

yeah, i found something i think by using the devices

#
    private void UpdateDevice()
    {
        if (playerInput.currentControlScheme == "Keyboard&Mouse")
        {
            currentDevice = DeviceType.KeyboardAndMouse;
        }

        if (playerInput.currentControlScheme == "Gamepad")
        {
            currentDevice = DeviceType.Gamepad;
        }
    }

This is what i have found on a forum, i think it works pretty well and am using it for now but maybe there are other ways that also work well

#
    private void OnLook(InputValue value)
    {
        lookInputValue = value.Get<Vector2>();

        lookInputValue.y *= -1.0f;

        if (currentDevice == DeviceType.KeyboardAndMouse)
        {
            lookInputValue *= 2.0f;
        }

        if (currentDevice == DeviceType.Gamepad)
        {
            lookInputValue *= 2.0f * Time.deltaTime;
        }
    }

This piece of code uses it to apply deltaTime only when it's a gamepad

flint marten
#

Does PerformInteractiveRebinding() need any special code to complete the rebinding? I have it linked to a button, and when i press that button and then do some sort of input it does everything it needs to except rebind the button. Like I have time paused (will probably remove later, currently doing testing) and I change the text, and it does successfully do all that stuff but it doesn't actually rebind my input, jumping (which is the input im trying to rebind) still activates when I press space (what I have it on initially) rather than whatever I pressed last while trying to rebind. I've tried doing multiple things such as setting my jump variable (which other scripts reference when I want to add or remove something) to Player.Jump; setting my jump variable as a get to Player.Jump; adding something to jump with playerControls.jump += _ => Jump() (or whatever other code I have here); setting jump up in Behavior on my PlayerInput to InvokeUnityEvents and linking them there in Player; and some weird thing with dictionaries that I don't know how to explain because nothings been working even though it did work in the videos/scripts/tutorials ive watched

marble flare
#

Is there any way for the Input System to detect any key/gamepad button press? Something like the old input system:

Input.anyKey

austere grotto
#

That will only be for keyboard though

maiden pasture
#
            Debug.Log("[CLIENT] Setting up skill inputs");

            void OnSkillOne(InputAction.CallbackContext _) => skillMechanic.Skill(0);
            
            skill1.action.performed += OnSkillOne;
          
            SignalStream.GetStream(StreamId.Player.Disconnected).OnSignal += (_) =>
            {
                Debug.Log("[CLIENT] Removing skill input events");

                skill1.action.performed -= OnSkillOne;
            };

I am trying to unsubscribe performed events here but it just does not work and I have no idea why. Any idea how to clear the performed callback list? skill1 is of type InputActionReference

austere grotto
#

What is SignalStream

maiden pasture
marble flare
stark notch
#

I found a helpfull answer on the forums for the bug in the UI you can have with the input system.
If you get the warning
Unable to find style 'ToolbarSeachTextField' in skin 'DarkSkin' Used
UnityEngine.InputSystem.Editor.InputSettingsProvider/<>c__DisplayClass14_0:

you can just double click on it and make sure that the word Search in the strings are written with an r.
The script this is in is the AdvancedDropdownGUI.cs script.

13 #if UNITY_2023_2_OR_NEWER || UNITY_2021_3_28 || UNITY_2022_3_1
14            public static readonly GUIStyle toolbarSearchField = "ToolbarSearchTextField";
15 #else
16            public static readonly GUIStyle toolbarSearchField = "ToolbarSearchTextField";
17 #endif
#

one of the two is accidentally written as Seach which causes the UI to have this bug and get a warning

#

wait long enough after adjusting the string too sometimes it changes back because it is still loading i think

#

You can find it here: Packages > Input System > Editor > Internal > AdvancedDropdown > AdvancedDropdownGUI.cs

uncut swift
#

is there a way to get the name of an action map when accessed through the c# class?
I tried it like this

void SetInputListeners(InputActionMap actionMap)
    {
        
        switch (actionMap.name)
        {
                case InputManager.Actions.Exploration.name:
                    //subscribe to Exploration inputs
                break;
        }
    }

but the Exploration.name isn't a thing

austere grotto
uncut swift
#

it's a reference to the c# class generated by the file

#

rn I'm trying to bypass needing that name by just using an enum

#

but if there's a better way to do this I'm open for input xD

austere grotto
#

can you share your generated C# class? I'm trying to find an example of my own 😆

#

possibly the wrapper exposes a reference to the actual InputActionMap it wraps

uncut swift
#

what's the site again to share large blocks of code? xD

austere grotto
#

!code

sonic sageBOT
uncut swift
austere grotto
#

Can you do Inputmanager.Actions.Exploration.Get().name

uncut swift
#

basically, I have an event that invokes when I change actionmaps, and I want scripts to listen to it and subscribe to actions that are now active, and unsubscribe from everything else

#

ok that works, but not in a switch case for some reason

#

oh a switch case wants a constant value...

#

I guess I'll just try with the enum ID getting passed along in the event

austere grotto
#

you could also directly compare instances, or just use an if/elseif chain instead of a switch

uncut swift
#

nameof doesn't give any errors. lemme test the code rq

#

ok it works

#

nice

#

thanks a lot xD been struggling with that one for a while

peak peak
#

Is there a built-in way to detect mouse/pointer clicks? Meaning, down and up on the same point (within some threshold) or do i need to track that myself?

peak peak
flat jay
#

Hello, I'm currently converting my PlayerController to the new input system. When I rewrite my lines I have the problem that with the old input system the tires move "slowly" to the left and right. When I use the new input system they are completely left or right depending on which direction I press. What is the problem or do I have to figure it out?

' m_JeepVisual.SteerInput = Input.GetAxis("Horizontal");`

#

m_JeepVisual.SteerInput = Input.GetAxis("Horizontal");

#

` private void HandleInput(Vector2 driveInput)
{
// Verwende die MovementInput-Informationen, um die Fahrzeugsteuerung zu aktualisieren.
if (m_Vehicle == null) return;

        // Du kannst beispielsweise die X-Komponente von MovementInput für die Lenkung und die Y-Komponente für die Beschleunigung verwenden.
        m_Vehicle.SetSteerInput(driveInput.x);
        m_Vehicle.SetAccelerateInput(driveInput.y);
    }`
scarlet crystal
#

So I posted a question in #💻┃code-beginner and I'm not actually sure that was the right place to put it (also it got ignored) (it's def a beginner concept but my level of general coding knowledge seems less beginner after seeing some of that chat) the concept also fits this channel, is it cool if I 'break' the no posting to multiple channels rule and move the question over here

flat jay
#

What do u need ?

#

My behaviour is like "GetAxisRaw" is there a way for a "filter" with the new Inputsystem ?

scarlet crystal
#

Let me know if you want me to move the code blocks over but basically I'm trying to bind jump to "up" instead of a button, but for some reason the physics dosn't like it (or the way I'm doing it) and sends me to space. I've tried a few things but it's either slightly better or worse

flat jay
#

Is there a "Interpolation Filter" for the New Inputsystem ?

scarlet crystal
#

ok maybe I do belong in beginner

#

Cause I have absolutley no idea what that means

austere grotto
#

As long as you have a physics Raycaster

peak peak
# austere grotto You can use IPointerClickHandler for world space interactions too

Yes, but that's not what i'm looking for, it inverts the kind of control i try to implement. I don't want the objects to be reactive, but need the input action dispatching to be conditionally targeting different potential receivers, and for that i want to detect the kind of click independently of what was clicked. I saw that there are modifiers or something like that which allow input actions to have a perform-time (i.e. 0.5s mouse button held down), so i hoped that there was something similar for a sequence of down-up, that models the normal, expected pointer click behaviour.
But now that i wrote that out, i see that these are called 'interactions' and that there indeed is 'tap', which is kind of what i want.

solemn python
#

hi, for some reason out of the blue on startup my game is throwing this:

NotSupportedException while resolving binding 'Navigate:<Gamepad>/rightStick/right[;Gamepad]' in action map 'DefaultInputActions (UnityEngine.InputSystem.InputActionAsset):UI'
UnityEngine.InputSystem.UI.InputSystemUIInputModule:OnEnable () (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:1453)

NotSupportedException: Control count per binding cannot exceed byte.MaxValue=255
UnityEngine.InputSystem.InputActionState+BindingState.set_controlCount (System.Int32 value) (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Actions/InputActionState.cs:3305)
UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap actionMap) (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Actions/InputBindingResolver.cs:391)
UnityEngine.InputSystem.UI.InputSystemUIInputModule:OnEnable() (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Plugins/UI/InputSystemUIInputModule.cs:1453)

I dont have any right stick input mappings in either my UI or Player actionmaps. Any idea what i might have done? It was working fine!

#

maybe I should restart the editor, its been a good few days 🙂

#

lol yea that was it

#

restart unity more than every five days

stark notch
#

I have a small question i would like to use callback context with the playerinput component but i had an error from the playerinput component saying it can't find the OnLook method.

    private void OnLook(InputAction.CallbackContext context)
    {
        LookInput = context.ReadValue<Vector2>();
    }

First i used the InputValue but for checking the device the input comes from i would like to use callbackcontext since you can use it to check

stark notch
#

i found it i forgot you need to change the playerinput events

vale raptor
#

hey so im trying to leanr the new input system and im kinda confused so this is how my old movement keybinds where how would i make that in the new input system

#

smth like this maybe

#

and then this to get that value

horizontalMove = value.ReadValue<float>() * m_Speed;
austere grotto
#

there are several ways to use the new system

vale raptor
#

yeah im trying its just i really dont wanna remake my whole player controller

#

this new input system is really weird

austere grotto
vale raptor
#

and confusing

austere grotto
#

it's confusing mostly because there are multiple ways to use it

#

it might also be confusing if your C# is not that strong and you aren't familiar with events for example

vale raptor
#

yeah i guess its just i was used to only needing 1 line of code for it instead of adding all this other stuff

#

i guess i will watch a tutorial then

#

and just somewhat remake my character controller script

#

why does theres have the calback context thing but mine doesnt

austere grotto
vale raptor
#

ok

vale raptor
#

how should i do movement properly because right now its really horrible

private void FixedUpdate()
{
    m_Rigidbody2D.velocity = movement;
}
public void Move1(InputAction.CallbackContext ctx)
{
    Vector2 inputVector = ctx.ReadValue<Vector2>();
    movement = Vector2.SmoothDamp(m_Rigidbody2D.velocity, inputVector * m_Speed, ref m_Velocity, m_MovementSmoothing);
}
#

you never stop moving it seems and all around bad

vale raptor
#

Could you explain more in-depth for that I’m confused

vale charm
#

does anyone know why OnPauseGame() does not work?

#

the brake one works and its the same type

tulip tartan
# vale raptor Could you explain more in-depth for that I’m confused

Sorry, just seeing this (I was taking an exam)

Basically, the most reliable way I've found is to make a bool and set it to true or false based on the CallbackContext state
It passes a .started state when you first press the key/whatever, a .performed state two or three times during it (from what I understand) and a .canceled state when you stop the input.

So, where you get .started, set a bool called moving to true
When you get .cancelled, set it to false.
If moving is true, move based on the vector you would get (your code already stores that, so i won't go more into that part)

vale raptor
#

Aight thanks

half geyser
#

Hello, I'm trying to add mobile input for the frist time. I'm using the new input system with "On-Screen Stick" & "On-Screen Button" Components. They are working fine independently, but cancel each other out when I try pressing both the stick and the button at the same time.

I set the "Action Type" to "Pass Through" but that didn't resolve it

#

Is is completely necessary to create a custom script to get this working? Or is that not necessary and I'm doing something wrong?

austere grotto
half geyser
#

I set the stick to gamepad left stick and the button to gamepad right trigger

This is what I'm currently using for my keyboard and Controller input.

Should this also work for mobile?

#

I hope that answers your question

crimson schooner
#

Hello. I'm having an issue where the new input system isn't able to process inputs from a common peripheral players my target audience are likely going to use

#

When using the C stick on a gamecube controller, the inputs are processed through the RZ and Z axiscontrol fields

#

However whenever I try to pull up those values in the new input system plater actions, they don't show up

#

(Everything ebove here on the menu is buttons 1-9)

#

Does anyone know how to force input actions to accept certain types of input from the input debugger

chrome mirage
supple crow
#

Ran into an interesting problem. I named a class InputSettings. This broke the Input System Package menu..

#

It looks OK now that I've renamed my class.

hollow light
#

I've seen some tutorials where a script instantiates a new InputActionAsset for a controller in Awake/Start but the PlayerInput component also has a reference to one of these.

If my game has multiple controllable actors (where only one is controlled at a time) is it wiser to access the same reference to the asset belonging to PlayerInput rather than each instantiating their own? or is the difference negligable

#

if I should reference PlayerInput.actions: How can I cast this to my own asset type? e.g. my map asset is called "PlayerControls" so how can i cast actions (which is type InputActionAsset to PlayerControls") or should I change any references to reference a general InputActionAsset and find actions within like [""] instead?

#

Another thing to note is I reference the control asset when subscribing my inputs, would it be wiser to only reference maps instead?

hollow light
#

Sorted it, switched to referencing maps instead of the asset and all is fine

exotic phoenix
#

Is there a go-to way of mapping input system axis values to a different range? Or do you guys use Lerp for that?

austere grotto
exotic phoenix
idle trail
#

If two actions use the same input does it only trigger one? I am using space for the y+ for my movement, but also for jump, but jump isn't getting called for some reason.

#

I see it working for the y+ movement though

idle trail
#

And yep, if I get rid of the space on move now jump is working... Is there anyway to have both?

fading barn
#

from what i tested

idle trail
#

Yeah, once I removed it from the movement it was working for jump. I think I saw some setting for this somewhere but no clue.

#

This is working for now

inland quail
#

I have been struggling with element focusing using a controller for a while now.

All I want is, when the Start or Select button is pressed and the UI canvas appears, 'Focus' an element where I can contineu my navigation form using a controller 🥹

using

EventSystem.current.SetSelectedGameObject(initialSelectedObject);

Actually selects the button. I want to simply focus notlikethis

austere grotto
limpid sleet
#

I've left this message on general but I'll also leave it here in case anyone has any idea. I've been experiencing issues after moving to new player input system. When I'm just moving with A/D around an object or corner or anything looks smooth but if a move the camera and press A/D it's becomes really jittery. I'll attach a video below. If anyone has any ideas, I'll hear them out happily. Thank you!

austere grotto
limpid sleet
limpid sleet
austere grotto
limpid sleet
thick badger
#

Hi, is anyone free to help me go through some issues im having. I am using the new input system and using the rebindUI sample from it but the keybinds aren't being preserved across scenes.

#

I have a mainmenu with a settings gameobject where the rebindUI is set up, but upon saving it, it doesn't seem to change the controls when i start the game and move to the next scene

austere grotto
#

The basics are that rebinding applies only to the exact instance of the inputactions asset that you apply them to.

#

Any other instances will not be affected

#

If you are using for example the generated C# class, every time you create an instance of that with new(), that's a totally separate instance.

iron flicker
#

Hey, Is it necessary to write this here?

solar skiff
#

Hey, so I have this code reading the state of a button:

ButtonOne.performed += ctx => _buttonOneValue = ctx.ReadValue<float>();

which works fine. How can I have that call a function also?

young spade
solar skiff
#

So, I want to run a function within this class when the button is pressed, as well as saving the value of that button. Eg I want to:

set buttonOneValue

and run ButtonOne();

#

I'm new to " =>" and don't really know how it works, can I insert running that function in there somehow? Very nooby soz

young spade
#

Aaah okay

#

So from my perspective (Webdev) the ButtonOne.performed has a type of void which is used to execute pieces of code, and it also gives you the context, like you named that variable

solar skiff
#

I'd rather not monitor the value of buttonOne for changes then call of the function like that

young spade
#

The += value just gives you the value of the action, and the part after the => is the callback part, where you can use the left hand side variable(s), in this case the context, to execute commands.

So in your case, you want to store the value and also execute a function.

You could make another function that handles all that, or put the set buttonOneValue, into your ButtonOne() function to handle.

#

(I'm still learning this system, so if my explanation is wrong then feel free to correct me :D)

young spade
#

In my implementation, I made a variable that tracks the state of said button, and in the Update method, I just call the function that handles the logic with that variable

#

So like:

_inputController.PlayerMovement.Movement.performed += i => _movementInput = i.ReadValue<Vector2>();
}

Update() {
FunctionThatHandlesMovementInputStuff();
}

FunctionThatHandlesMovementInputStuff() {
 if this then go forward
}
solar skiff
#

ok, I was considering doing it like that but thought maybe there was a clearer way to call that function from within the event as well as setting the value

#

rather than setting the value in the event and checking that value for changes every frame

young spade
#

Well, in this case, the inputController will automatically update the value

#

That's why I dont call a function inside the performed =>, but a variable change

solar skiff
#

ok thanks, I'll do it like that

boreal ruin
#

Hey, I just finished doing my rebinding system with the new input system. However, when i'm with my controller, and when i'm selecting any rebinding button with my joystick, when i'm pressing A (buttonSouth), it opens my rebinding panel, and selects instantly the A button for the input, i really need to just take the A to open, and press again A input, if i want the A to be the input. So my question is, how can i fix that?

marsh lava
#

Oh hi @boreal ruin , I'm here exactly with the same issue XD

boreal ruin
#

lmao i know that feeling, i've another one but i think i can fix it by myself

marsh lava
#

Here's the code I call in LateUpdate just after rebiding:

#
        InputSystem.Update();
        foreach (InputActionMap actionMap in UI.InputControls.actionMaps) {
            foreach (InputAction action in actionMap.actions) {
                action.Reset();
            }
        }```
boreal ruin
#

But that code doesn't fix the problem, right ?

marsh lava
#

you should also call this after 'RemoveAllBindingOverrides' and 'LoadBindingOverridesFromJson'

#

it fixes gamepad issue for me

#

but I just found out that I get similar behavior with 'Esc' key when leaving the binding menu and this code doesn't fix this issue

boreal ruin
#

You can add something for escape

marsh lava
#

nah, not my issue

boreal ruin
#

aw okay

#

I don't think the code u gave just before could fix mine as well tbh

#

there's no link between loading from json and the issue i got

marsh lava
#

it's because for 'Esc' I'm closing the menu and restoring the state (user canceled) with either 'LoadBindingOverridesFromJson' or 'RemoveAllBindingOverrides'. This causes the 'Esc' key to repeat

boreal ruin
#

oooh ok i see, well tbh i'm not a pro with input system 😂

marsh lava
#

the same as when rebiding gamepad keys repeats them

boreal ruin
#

yeah probably

marsh lava
#

the Input System is nice, and even the rebinding mechanism is relatively easy to implement, but there are bunch of small issues like this input repeat

#

And it's in 1.6.3 and 1.7.0. I don't know how they missed it.

boreal ruin
#

Yeah idk too, but i think some people on this server know that system better than us and could save us lmao

#

i hope

marsh lava
#

Do you know if this channel is monitored by someone from the Input System team?

boreal ruin
#

i don't really know but actually i saw in the past that people answered people's questions

marsh lava
#

'kay, so now we wait I guess 🙂

boreal ruin
#

so maybe yeah

#

yeah x)

marsh lava
#

@boreal ruin 'kay, so my 'Esc' problem was my own. It triggered only when rebinding functions were called on exit, but was not connected to Input System. So I guess my piece of code works then.

boreal ruin
#

probably yeah x)

marsh lava
#

However, other issue is that 'value' type inputs on gamepad (sticks, triggers) get repeated on rebind no matter what. It's kind of by design, because after rebind the state of all input actions gets cleared and then value inputs are read on reinitialization and generate new event. It's an issue when you use value inputs as buttons (triggers), or for navigation in menus.

boreal ruin
#

U mean that if u rebind the button east of the gamepad, u cannot go back again with button east when u navigate the menus? i don't really understand

marsh lava
#

If I rebind UI/navigation/down to <Gamepad>/leftStick/down, then just after rebind the UI will move selection down.

#

If I rebind UI/navigation/submit to <Gamepad>/rightTrigger, then just after rebind UI will trigger another rebind on the same action.

boreal ruin
#

oh really?

#

wtf

#

I'm not using UI navigation rebinding tbh, i let it as it's given by Unity directly

#

I think it's common in every game

marsh lava
#

I want to use same input for ui navigation and movement, more user-friendly IMHO

#

I think like if someone with disability wants to rebind all inputs to one side of the gamepad. It's nice if this works for UI also

tropic verge
#

Hi, how can I create a Text Input action in the new Input system?

austere grotto
tropic verge
austere grotto
#

how would that work?

tropic verge
#

I ask it for a string value and it gives me the characters entered on the keyboard on the current frmae

#

something like that? if that exists in this system

#

or a list of Keycodes maybe

tropic verge
#

do I need to enable the old input system for this?

#

nvm I'll just try. thanks!

austere grotto
#

I don't see how the old input system would help you

glass tangle
#

Hi

Exist a function similar of "KeyDown" in the new input system?

tulip tartan
glass tangle
#

Ok

tulip tartan
#

Or you can use .started from CallbackContext
You're gonna need to disable your own bool from that though

glass tangle
#

How am I know this device is using in this moment?

austere grotto
#

You generally don't need to

verbal wolf
#

I have a question... with the new Input System can i use controller buttons and joystick to simulate a virtual touch screen? i made this terrible doodle with the Playstation 4/5 Controller as touch inputs for visuals, because that might be helpful to kill 2 birds with one stone!

glass tangle
austere grotto
verbal wolf
marsh lava
#

@verbal wolf you want to create a separate mobile app that would trigger touch inputs in other app, based on controller inputs?

verbal wolf
#

not really? imagine this.. few tablets got a keyboard support like the iPad for example yea? that support keyboard inputs in that game for example, so i've added the keyboard input first, then the last 2 device controls are left, touch and controller inputs in the same game, so i was wondering is it possible i can kill 2 birds with one stone to merge touch as virtual controller inputs and controller inputs altogether to save time? but when a controller connects to that game, the touch hud goes invisible, that is my question, also side note: i'm pretty new to this input system, just watched one of Samyams video about it and also taking a break to take info slowly

#

also the touch input works exactly as the controller

#

basically a cross-input game support EDIT: sorry if the message is rushed, my head is all over place due to over learning unity

marsh lava
#

So I would assume (never did it myself, I'm more of PC/consoles guy) that the touch interface (like from the screenshot) is done using UI buttons and such. Those buttons trigger some logic in your game, and this is almost entirely outside of the Input System (only the raw touch input comes from it). What you probably want to do is just trigger the same logic based on controller inputs coming from the Input System. There will be some additional code needed, but not much, and probably a lot less than trying to trigger UI buttons based on the controller input, especially if those buttons will be disabled/hidden (because this is what you want to do when you detect a physical controller).

verbal wolf
#

ah i see now, so i need to add it's own control scheme like the touch input itself without relying on the controller scheme? if so thank you for the answer 🙂

#

oh yea i forgot to mention, i'm focusing my games mostly on the apple ecosystem, So that's Mac (Keyboard), touch devices but some people might want a controller support

frosty ledge
#

so, I am trying to make a 3rd person controller with cinemachine and input system, but, it's not working, could anyone help?

verbal wolf
#
public class PlayerController : MonoBehaviour
{

    [Header("Jump and Gravity Setiings")]
    [SerializeField] private float playerSpeed = 2.0f;
    [SerializeField] private float jumpHeight = 1.0f;
    [SerializeField] private float gravityValue = -9.81f;

    private CharacterController controller;
    private Vector3 playerVelocity;
    private bool groundedPlayer;
    private InputManager inputManager;
    private Transform cameraTransform;

    private void Start()
    {
        controller = GetComponent<CharacterController>();
        inputManager = InputManager.Instance;
        cameraTransform = Camera.main.transform;
    }

    void Update()
    {
        groundedPlayer = controller.isGrounded;
        if (groundedPlayer && playerVelocity.y < 0)
        {
            playerVelocity.y = -0.1f;
        }

        // Our Player Movement!
        Vector2 movement = inputManager.GetPlayerMovement();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
        move.y = 0f;
        controller.Move(move * Time.deltaTime * playerSpeed);

        // if (move != Vector3.zero)
        // {
        //     gameObject.transform.forward = move;
        // }

        // Changes the height position of our Player!
        if (inputManager.PlayerJumpedThisFrame() && groundedPlayer)
        {
            playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
        }

        playerVelocity.y += gravityValue * Time.deltaTime;
        controller.Move(playerVelocity * Time.deltaTime);
    }
}``` i know this is a FPS controller but it should work atleast with the third person due to cinemachine
#

also have a input manager script maybe this will work?

#
{
    private static InputManager instance;

    public static InputManager Instance
    {
        get
        {
            return instance;
        }
    }

    private PlayerControls playerControls;


    private void Awake() 
    {
        if(instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
        }

        playerControls = new PlayerControls();
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;
    }

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

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

    public Vector2 GetPlayerMovement()
    {
        return playerControls.Player.Movement.ReadValue<Vector2>();
    }

    public Vector2 GetMouseDelta()
    {
        return playerControls.Player.Look.ReadValue<Vector2>();
    }

    public bool PlayerJumpedThisFrame()
    {
        return playerControls.Player.Jump.triggered;
    }
}```
#

also have you made your "WASD" controls with these composite

frosty ledge
verbal wolf
#

no probs!

verbal wolf
#

Is that like a script component if I remember correctly?

#

Yep just saw the docs thanks

austere grotto
#

That's an old doc too

#

Do look at the modern one

#

I'm on my phone

verbal wolf
#

I’ll check that tomorrow, thanks for the info tho!

glass tangle
#

How can detect the button of the device that pressed?

boreal ruin
#

Hey, how can I detect in another script, when a rebind is complete ? Because i cannot add an other script in "RebindActionUI" script

tiny oyster
#

hey, ive been stuck on this for a while now, i really cant seem to figure it out. basically i want to add on-screen controls to my game, and they just aren't working right. in this very simple example i have an on-screen stick that is for the left stick on a gamepad, i have a gameobject with a simple script that moves it based on the move action in the defaultinputactions. EventSystem is also set to defaultinputactions

#

when i try dragging the stick it seems to be constantly switching control modes on the object, so turning auto-switch off makes the stick work, but it doesnt control the object anymore...

glass tangle
#

Hi

#

Why i can't play with a gamepad if this is connected?

#

The schemes the controls is the following way

glass tangle
#

Please

lyric pivot
#

how to add the 3rd on screen stick, apart from left and right gamepad sticks, i am using android stick but somehow not working, what am i doing wrong?

verbal wolf
#

How does making a Run Control work? i've added a Shift and Press Left Joystick to make the character run but didn't work, it says "Cannot Read Vector2 because control is a Float" here is the script, i'm basically copying the Move method to the Run method, here is the script

```private void PlayerMove()
{
    // Our Player Movement!
    Vector2 movement = inputManager.GetPlayerWalk();
    Vector3 move = new Vector3(movement.x, 0f, movement.y);
    move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
    move.y = 0f;
    controller.Move(move * Time.deltaTime * playerWalkSpeed);
}   

private void PlayerRun()
{
    // Our Player Movement!
    Vector2 movement = inputManager.GetPlayerRun();
    Vector3 move = new Vector3(movement.x, 0f, movement.y);
    move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
    move.y = 0f;
    controller.Move(move * Time.deltaTime * playerRunSpeed);
}```

then the input manager script

 {
     return playerControls.Player.Movement.ReadValue<Vector2>();
 }

 public Vector2 GetPlayerRun()
 {
     return playerControls.Player.Run.ReadValue<Vector2>();
 }```
Also the original script belonged to the Unity Docs of CharacterController.Run lemme find a link for the script 
https://docs.unity3d.com/ScriptReference/CharacterController.Move.html

anyways the regular Movement i forgot rename to walk is Vector 2 Value and Run is a button, but i don't want my character to run all the time, i want to add a toggle to run and then walk again.
austere grotto
#
public bool GetPlayerRun() {
  return playerControls.Player.Run.ReadValueAsButton();
}```
#

it's a button, it's either pressed or not pressed

verbal wolf
#

Oh I see, I’m trying to a make toggle run

verbal wolf
#

okay i've checked the code you've given me somehow there isn't "ReadValueAsButton" somehow in the InputManager Script? i might aswell give you the whole script for full context. this is the Input Manager Script for the gameObject to make our inputs work ```using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InputManager : MonoBehaviour
{
private static InputManager instance;

public static InputManager Instance
{
    get
    {
        return instance;
    }
}

private PlayerControls playerControls;


private void Awake() 
{
    if(instance != null && instance != this)
    {
        Destroy(this.gameObject);
    }
    else
    {
        instance = this;
    }

    playerControls = new PlayerControls();
    Cursor.visible = false;
    Cursor.lockState = CursorLockMode.Locked;
}

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

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

public Vector2 GetPlayerWalk()
{
    return playerControls.Player.Movement.ReadValue<Vector2>();
}

public Vector2 GetPlayerRun()
{
    return playerControls.Player.Run.ReadValue<Vector2>();
}

public Vector2 GetMouseDelta()
{
    return playerControls.Player.Look.ReadValue<Vector2>();
}

public bool PlayerJumpedThisFrame()
{
    return playerControls.Player.Jump.triggered;
}

public bool PlayerInteractedThisFrame()
{
    return playerControls.Player.Interact.triggered;
}

public bool PlayerTriggeredThisFrame()
{
    return playerControls.Player.Trigger.triggered;
}

}```

verbal wolf
# verbal wolf How does making a Run Control work? i've added a Shift and Press Left Joystick t...

and this code reference to the PlayController script on top but with it's variables had to make the code small due to nitro...```[RequireComponent(typeof(CharacterController))]
public class PlayerController : MonoBehaviour
{
[Header("Walk and Run Settings")]
[SerializeField] private float playerWalkSpeed = 2.0f;
[SerializeField] private float playerRunSpeed = 6.0f;

[Header("Jump and Gravity Setiings")]
[SerializeField] private float jumpHeight = 1.0f;
[SerializeField] private float gravityValue = -9.81f;

private CharacterController controller;
private Vector3 playerVelocity;
private bool groundedPlayer;
private InputManager inputManager;
private Transform cameraTransform;

private void Start()
{
    controller = GetComponent<CharacterController>();
    inputManager = InputManager.Instance;
    cameraTransform = Camera.main.transform;
}```
austere grotto
austere grotto
verbal wolf
#

i just typed in the exact thing unless i haven't saved my input in a rush... lemme double check

austere grotto
#

You're still trying to make it a Vector2 which makes no sense

austere grotto
verbal wolf
#

checking the input actions and it's main script now.

austere grotto
verbal wolf
#

thank you i'll let ya know! trying it now EDIT: okay the input manager script is happy but imma sleep now thanks Praetor

austere grotto
#

changed it to a better version.

glass tangle
#

Hi

#

Question
The new input system is compatible with the webgl?
With the games of browser?

austere grotto
#

it works with all platforms

glass tangle
#

ok

verbal wolf
#
    {
        // Our Player Walk!
        Vector2 movement = inputManager.GetPlayerWalk();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
        move.y = 0f;
        controller.Move(move * Time.deltaTime * playerWalkSpeed);
    }   

    private void PlayerRun()
    {
        // Our Player Run!
        Vector2 movement = inputManager.GetPlayerRun();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
        move.y = 0f;
        controller.Move(move * Time.deltaTime * playerRunSpeed);
    }``` 

Okay day 2 of this problem, Input Manager script is happy which is good.

But the Player Controller script is not happy i've tried to replace all Vector2 and Vector3 with bool within the PlayerRun() method but still not happy also it cannot convert bool to Vector2.Unity, here's the thing i'm confused about, and here how i think my run method should be.. My run method should be the same as PlayerWalk() method but with double speed which i'm confused about plus it is in the 3D space so Vectors make sense really for this?

i'm gonna re learn vectors again...
#

also the tutorials i've used are SamYams by the way but i've twisted into my own, from what i've Known via learning Unity Courses.

austere grotto
verbal wolf
#

yea this is my first time to think and create my code from my knowledge without relying on tutorial hell

austere grotto
#

You should have two action:
The movement direction action which is a Vector2, and the run actions which is a button aka bool

#

All you need to do is take the move direction and multiply it by your current movement speed

#

The movement speed is different depending on whether the run button is pressed or not

#

E.g.

void Update() {
  Vector2 moveDir = inputManager.GetPlayerWalk():
  float speed = InputManager.GetPlayerRun() ? run speed : walkSpeed:
  moveDir *= speed;

  // then do the movement 
}```
#

Walk and run should not be totally separate functions like you have

#

Not even sure how that'd work

verbal wolf
#

alrighty i'm gonna try that soon or something i'll let ya know, also how do i "learn" C# by using Unity Docs or watch basics video to learn but not to follow?

austere grotto
verbal wolf
#

thank you praetor once again!

clever oyster
#

UI dpad on Steam Deck

vale raptor
#

for the new input system how do i tell if a controller is being used

verbal wolf
tiny oyster
snow crypt
#

Hey there I have a small question about the new input system.
So my game has JumpStarted and JumpCanceled methods which get called by respectively pressing and releasing the jump button, through events using the new input system. This works fine in most cases.
However, let's say I am in the pause menu and then release the jump button which calls the JumpCanceled method and then unpause the game. As I've already released the jump button, the code from the JumpCanceled method will not be called. Is there anything I can use to fix this using the new input system?

austere grotto
snow crypt
#

Alright, I'll try it out. Also, is there any way to check if a button is being held down using the new input system?

austere grotto
#

Sure. IsPressed() on the InputAction

snow crypt
#

Thx

minor charm
#

Anybody know if there's something like InputActionReference that works with addressables?

austere grotto
minor charm
# austere grotto Wdym by "works with Addressables"?

InputActionReference uses a reference to the asset itself, but if the InputActionAsset is stored with addressables you'll get a separate asset than the one stored in addressables, hence why addressables have AssetReference.
But if I use AssetReferenceT<ActionInputReference> I don't get the nice selector that InputActionReference has:

austere grotto
#

The actual asset is the InputActionAsset

#

You could probably write your own custom struct or class pretty easily that consists of an AssetReference<InputActionAsset> alongside a actionmap/action name path

#

Wouldn't be hard to write a simple custom property drawer for it that gives you a nice Dropdown

minor charm
austere grotto
#

Not that I know of

verbal wolf
#

I got this problem, i've copied this code for making a head bob script and adding the new input system but it say's no object references about it, but somehow it works with the legacy input system which is odd?

here is the script paste bin with comments and the error code line image with the player triggers and player camera components.

https://hastebin.com/share/egokiwoxuz.csharp

austere grotto
#

Naturally such a field will always be null

verbal wolf
#

ah i see welp time to make it public

austere grotto
#

When you try to access this null reference, you will of course get NullReferenceException

#

I would expect such a thing to probably be a singleton or something

verbal wolf
#

speaking of it is a game object singleton since i watched one of samyam tutorial if i remember

#

lemme find the tutorial

#

Learn how to use Cinemachine and the new input system to make a First Person Controller in Unity!

ᐅGet the full Source Code Bundle to my Unity Tutorials 🤓
https://sam-yam.itch.io/samyam-full-source-code-to-all-videos

**DO THIS ► There is an easier way to override the old input system values in cinemachine using the Cinemachine Input Provider (...

▶ Play video
austere grotto
verbal wolf
#

gotcha

austere grotto
#

That's the point of it

verbal wolf
#

thank you once again Praetor, but now i feel like a kid where the teacher guides me ha ha ha!

hollow quest
#

Let's say map like this:

            _playerInput.actions["Game/Toggle Console"].performed +=
                GameServices.ConsoleKeyInputsTemp.InputToggleConsole;

How can I clear all .performed first?

#

_playerInput.actions["Game/Toggle Console"] has no setter so I'm not sure, can't just overwrite it

austere grotto
hollow quest
ornate saffron
# hollow quest Nah, that's the thing, no setter:

that's by design, c# events don't guarantee much about the implementation of the event except that you can subscribe and unsubscribe, so you just have to make sure you unsubscribe everything you subscribe yourself

#

if you want it to act like a list, you can make your own list of delegates and invoke those when peformed happens, then you can clear it whenever you like

hollow quest
runic orbit
#

advantages vs disadvantage between both?

verbal remnant
#

Whether they are pro/con in a particular situation is for you to decide

tall shoal
#

I have a specific case where I want to update my scene on a different interval than the display interval, so I've moved all the logic from my "Update" to "FixedUpdate". Is there a way to make the input system work this way? A way to make it gather the input press and delta values between "FixedUpdate" calls so we can read them normally on "FixedUpdate"?

#

Nvm, I guess I just found it

shy trench
#

Hey all,

I was wondering how one might be able to set up the Switch Pro Controller to swap the A and B buttons within setup. Since the A button is on the East side and B is South I would like to accomodate that on PC. I tried to set up a specific control scheme for the Switch Pro controller but it falls back to the Gamepad configuration. Is there a way to check and force it to the Switch Pro configuration?

Edit: Found my issue. In my PlayerInput component for the prefab it was set to default to Gamepad. Yesterday when I was trying to set it to Any I would get a null reference issue. I'm not sure why I was getting that but I did revert my changes and try to re-implement. Once I re-implemented and set the the PlayerInput to Any it now works as expected.

tranquil island
#

if I have this set up to allow the user to drag the screen around, is it possibly interfering with other touch events?

#

I have this other component that isn't receiving mouse clicks or touch input, but the other UI buttons in it are

public class TextWordClick : MonoBehaviour, IPointerDownHandler```
austere grotto
#

Probably something is blocking it

tranquil island
#

it looks like I didn't need the press event at all, getting rid of it made no difference, sweet

#

is there a good way to check what's blocking it?

austere grotto
#

The press interaction is useless yes

austere grotto
#

Or vice versa

#

You can do some tricks with the event system too

tranquil island
#

kk, cheers

#

I'll try to figure it out

#

odd, but this was the only thing that worked in the end:

void Update()
    {
        if (!gameObject.activeInHierarchy)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            int linkIndex = GetLinkIndex();
            if (linkIndex != -1) // Was pointer intersecting a link?
            {
                Debug.Log("Link index: " + linkIndex);
            }
            else
            {
                Debug.Log("No link");
            }
        }
    }```
#

and once it had a camera it works 😄

sacred bobcat
#

macOS Sonoma 14.2 and 14.2.1 Clicks on window not working at all, does anyone know how to fix this? I have clients complaining 😦

snow crypt
#

Hey there, according to the Unity Documentation for the New Input System, Input events get called right before the Update function. This also means they're called after the FixedUpdate function. Is there any way to change it so they happen right before the FixedUpdate?

snow crypt
#

Thanks!

sacred bobcat
muted void
#

Does anybody know what to do with issues with the new input system on mobile where it constantly swaps between control schemes? (e.g. Touch and Gamepad with On-Screen controls)

austere grotto
muted void
austere grotto
muted void
#

To clarify, I'm referring to what is displayed here at the bottom, when I define buttons for the player I have to define what devices I intend to use, which I have specified to be Gamepad and Touch. The issue here is that even when I use the Gamepad it constantly swaps between Touch and Gamepad

unreal smelt
#

@austere grotto

toxic oxide
#

if i wanted to use one script to detect an input from the player that isn't on the player how would i do this?

muted void
toxic oxide
#

I'm very new to this input system so ty

muted void
#

e.g. Define a UnityEvent variable and invoke it in the player script. Subscribe to that event wherever you want and add a listener to it, then define a new function that will be called when you would invoke it.

toxic oxide
#

I'll try this and get back

austere grotto
unreal smelt
#

no dw about that, im working with netcode and i have a whole system setup, some stuff should be disabled by default and they get enabled upon instantiation. The rest of the input system works but the pause menu

austere grotto
#

pausing?

unreal smelt
#

yea

austere grotto
unreal smelt
#

but its in UI

#

in a different map

austere grotto
#

If you don't have that action map enabled it's not going to work

#

You have Player as the default map

unreal smelt
#

how do i switch it through code?

austere grotto
#

you have that here _playerInput.SwitchCurrentActionMap(pauseMenuUI.activeSelf ? "UI" : "Player");

#

I feel like you would want a pause action in BOTH maps though,no?

#

You want to pause from the game and unpause from the pause menu

unreal smelt
#

lemme try adding it to the player map

#

Alright so there's progress

#

now the pause menu is repeatedly getting turned on and off ("HandlePausing" function is called from Update)

#

fixed that, but pressing the pause button from the pause menu doesnt unpause

toxic oxide
#

My previous problem's been fixed, now how would i replicate the functions of GetButton, GetButtonUp, and GetButtonDown using the new input system, i have a script that uses all three of these and I'm not sure on how to implement it

#

My console is also getting bombed with thess errors which doesn't make sense to me:
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.Input.get_mousePosition () (at <963c3a1707f0469aac8b8356a8d18b5d>:0)
UnityEngine.UI.MultipleDisplayUtilities.GetMousePositionRelativeToMainDisplayResolution () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/MultipleDisplayUtilities.cs:40)
UnityEngine.EventSystems.BaseInput.get_mousePosition () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/BaseInput.cs:75)
UnityEngine.EventSystems.StandaloneInputModule.UpdateModule () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:178)
UnityEngine.EventSystems.EventSystem.TickModules () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:452)
UnityEngine.EventSystems.EventSystem.Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:467)

#

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
toxic oxide
#

ty for that, do you have any fix for my first problem?

toxic oxide
#

the 4th one i think

#

im using actions and a playerinput component

austere grotto
# toxic oxide im using actions and a playerinput component

if you're using the PlayerInput component your simplest option is to put it in "Use UnityEvents" mode. Then set up your events and you can add listeners like this:

bool isPressed = false;

public void MyListenerFunction(InputAction.CallbackContext ctx) {
  if (ctx.performed) {
    // this is like GetButtonDown
    isPressed = true;
  }
  else if (ctx.canceled) {
    // this is like GetButtonUp
    isPressed = false;
  }
}

void Update() {
  // You can use a bool variable here set from the above things
  if (isPressed) {
    // This is like GetButton
  }
}

Another option is to directly do things in update:

void Update() {
  // OR you can directly check things here:
  if (myPlayerInput.actions["ActionMap/ActionName"].IsPressed()) {
    // like GetButton
  }
  if (myPlayerInput.actions["ActionMap/ActionName"].WasPressedThisFrame()) {
    // like GetButtonDown
  }
  if (myPlayerInput.actions["ActionMap/ActionName"].WasReleasedThisFrame()) {
    // like GetButtonUp
  }
}```
toxic oxide
austere grotto
#

Just make sure if you do that you enable the action

toxic oxide
#

ok ty

#

nvm I'm still a bit confused on how to aplly this to my code specifically, here it is:

public IEnumerator JumpCo(float spriteHeightForce, float heightForce)
    {
        isJumping = true;
        float jumpStartTime = Time.time;
        AnimationCurve startingspriteHeightCurve = spriteHeightCurve;
        AnimationCurve startingHeightCurve = heightCurve;
        while(isJumping)
        {
            float jumpCompletionPercentage = (Time.time - jumpStartTime) / jumpDuration;
            jumpCompletionPercentage = Mathf.Clamp01(jumpCompletionPercentage);

            if(Input.GetButton("Jump"))
            {
                spriteRenderer.transform.localPosition = new Vector3
                    (0, startingspriteHeightCurve.Evaluate(jumpCompletionPercentage) * spriteHeightForce);
                entityHeight = startingHeightCurve.Evaluate(jumpCompletionPercentage) * heightForce;
            }
            if(Input.GetButtonUp("Jump"))
            {
                break;
            }

            if(jumpCompletionPercentage == 1f)
            {
                break;
            }
            yield return null;
        }
        isJumping = false;   
    }
austere grotto
#

Just like in my second example (or like that but with the InputActionReference)

toxic oxide
#

the thing is, it says action contains no definition for IsPressed()

toxic oxide
#

1.0.2

austere grotto
#

ooh - why that's super old

#

in that version you would have to do .ReadValue<float>() != 0

toxic oxide
#

that's weird why that was the option that came up

#

for the version

#

what's the latest one?

austere grotto
#

what version of Unity are you using

#

the latest version is 1.8

#

well 1.7.0 realistically

toxic oxide
#

oh yeah im using 2021

#

2021.1.16f1

austere grotto
#

1.7 should be available on anything past UNity 2019.4

austere grotto
#

You should upgrade to 2021.3 LTS

toxic oxide
#

will i have to change my project in any major way?

austere grotto
#

shouldn't have to

toxic oxide
#

ok ty

austere grotto
#

always make a backup /commit before upgrading ofc

#

just in case

toxic oxide
#

i do this in unity hub right?

austere grotto
#

yeah - install the new version then open the project with that version

toxic oxide
#

Do i restart unity hub when the blue bar is full?

#

i's still greyed which makes me think it's not finished but it's been like that for a minute and the blue bar is full for installation

austere grotto
#

Wait till the editor version finishes installing then you change the editor version for the project from this dropdown

toxic oxide
#

If i restart unity hub will it restart the download progress

#

looks like this

#

and i am now also realising i have an ancient version of unity hub too

#

ok updating unity hub made it download properly

#

my code doesn't seem to be working

toxic oxide
#

I wasn't sure what you meant by this

#

how would i do it?

austere grotto
#

call .Enable() on it

toxic oxide
#

in the OnEnable function?

#

i did that and it still isn't working

austere grotto
#

show the code

toxic oxide
#
public void Update()
    {
        if(jump.action.WasPressedThisFrame())
        {
            Jump(false, spriteHeightForce, heightForce);
        }
    }
public void Jump(bool isExtreme, float spriteHeightForce, float heightForce)
    {
        if(!isJumping && onFloor)
        {
            StartCoroutine(JumpCo(spriteHeightForce, heightForce));
        }
    }

    public IEnumerator JumpCo(float spriteHeightForce, float heightForce)
    {
        isJumping = true;
        float jumpStartTime = Time.time;
        AnimationCurve startingspriteHeightCurve = spriteHeightCurve;
        AnimationCurve startingHeightCurve = heightCurve;
        while(isJumping)
        {
            float jumpCompletionPercentage = (Time.time - jumpStartTime) / jumpDuration;
            jumpCompletionPercentage = Mathf.Clamp01(jumpCompletionPercentage);

            if(jump.action.IsPressed())
            {
                spriteRenderer.transform.localPosition = new Vector3
                    (0, startingspriteHeightCurve.Evaluate(jumpCompletionPercentage) * spriteHeightForce);
                entityHeight = startingHeightCurve.Evaluate(jumpCompletionPercentage) * heightForce;
            }
            if(jump.action.WasReleasedThisFrame())
            {
                break;
            }

            if(jumpCompletionPercentage == 1f)
            {
                break;
            }
            yield return null;
        }
      ```
austere grotto
#

Show the full script

#

use a paste site

toxic oxide
#

ok

austere grotto
#

!code

sonic sageBOT
toxic oxide
austere grotto
#

Ok and show the inspector for your script?

toxic oxide
austere grotto
#

Start adding Debug.Log

#

make sure the code is running

toxic oxide
#

ok

austere grotto
#

make sure the input is being detected

toxic oxide
#

it isn't

#

i debugged it

austere grotto
#

but the rest of the code is running?

toxic oxide
#

Let me check, it's hard to tell without the jump.

#

it actually isn't

#

it's not working properly

#

which is weird

austere grotto
#

Again, in the screenshot your script is not actually enabled

#

so I would guess it has something to do with that

#

maybe your system for enabling them isn't working

toxic oxide
#

that was just me being an idiot lmao, i had the script disabled because i thought it was what was bombing my console but i figured that problem out

primal falcon
#

Do you know one example project using Input System and UI Toolkit ?
I want to control my UI with gamepad, I can't figured it out.
The navigation seems to work (focus change on buttons) but "click" doesn't work

muted void
#

Is it possible to set a binding to only trigger on press once (as opposed to multiple times when it is continuously pressed)?

austere grotto
muted void
primal falcon
tranquil tangle
#

Do i ask questions about steamvr plugin inputs here?

#

I dont think unity is recieving input from it despite following everything in a guide

#

I am using steam link for quest

surreal moth
#

How do I make a virtual cursor that exactly matches the hardware cursor's behaviour 1:1? While keeping the hardware cursor locked and hidden.
I want the end user to feel like they're still using their mouse, but I have to keep the real mouse locked and hidden

#

Ive made virtual cursors, that part is easy, but I cant get it to replicate the 'gamefeel' of how the real OS cursor behaves (or at least my win10 one behaves)

#

is there any way to poll the OS or something for that data?

rough trench
#

A quick question:
Has Unity fixed the Copy and Paste of actions/control schemes etc in the InputActions editor window?
I believe it was broken with the introduction of the project wide actions and the new UI they made/changed for it.

spare frigate
spare frigate
# surreal moth Ive made virtual cursors, that part is easy, but I cant get it to replicate the ...

For general functionality like left clicks, mouse delta, scrollwheel, etc you can use Mouse.current: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Mouse.html - though if a player disconnects their mouse for whatever reason, then that class could return null, alternatively you could also set it up through a input asset, unless your referring to something else when you say "game feel" - if the mouse is locked, even polling the OS would probably give you the same position, so youd likely need to work with delta/change in offset from the locked position and use the local or screen space position of some UI that represents your "cursor"

junior phoenix
#

I have a action in the input system
type = value
control type = vector 2
with 1 binding:
Delta mouse

Im trying to use to get the mouse position using the input system
but when ever i try to debug log the vector 2 for this action it always returns (0,0)
I have also tried: mouse pos, pointer pos, and pointer delta and still all vector2's still read (0,0) no matter how much i move the mouse in the game scene in play mode.

if i put a binding for for other stuff like gamepad joystick under this action the debug log shows numbers correctly
what's the problem? am I doing something wrong?

pulsar lynx
#

I'm making an FPS type game for a number of systems, and I noticed that Cursor.LockState = CursorLockMode.Locked is not being respected on ChromeOs.
at some point Input.GetAxis("Mouse X") returns 0 because the cursor is at the edge of the screen so you can only turn left and right for as long as the cursor isn't touching the edges of the screen.
Does anyone know how to properly lock the cursos in ChromeOs?
yes, I turned off "Chrome Os Input Emulation".

austere grotto
#

And if you want mouse position you should bind it to mouse position

#

Not Delta

dusty elk
#

Hi all. I listen to the mouse movements but I use it to move a virtual cursor and I perform my own raycast from that cursor. Is there a way I can disable the extra built-in raycast of the Event System that I think I have no use for (without completely disabling the mouse)?

austere grotto
#

I would recommend using the event system though rather than building your own

dusty elk
#

I use the event system, just not the actual cursor built-in cursor which I lock at the center of the screen and hide. I can have up to 4 virtual cursors (local coop couch game). The mouse moves on of the virtual cursor and extra controllers the other three.

#

So for each "virtual" cursor I do this:

junior phoenix
#

@austere grotto my input asset is in the scene and my action works fine with other bindings just not mouse ones

dusty elk
#

It's possible this is not the right way to do things but as it stands I have no use of the automatic raycast of the Event System from the cursor locked and hidden at the center

austere grotto
#

They're assets

#

You'd have to show your code

#

And how it was hooked up to the input actions

junior phoenix
#

my bad I was thinking about the input component

junior phoenix
# austere grotto You'd have to show your code
public class InputManager : MonoBehaviour
{
    public static InputManager instance;

    public Vector2 PointerPosition { get; private set; }

    private PlayerInput _playerInput;

    private InputAction _pointerPosition;

    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        _playerInput = GetComponent<PlayerInput>();

        SetupInputActions();
    }
    private void SetupInputActions()
    {
        _pointerPosition = _playerInput.actions["PointerPosition"];
    }
    private void Update()
    {
        UpdateInputs();
    }
    private void UpdateInputs()
    {
       PointerPosition = _pointerPosition.ReadValue<Vector2>();
    }
}
    //in different script
    private void Update()
    {
        Debug.Log(InputManager.instance.PointerPosition);
    }
austere grotto
#

Also could be a control scheme thing

junior phoenix
#

for example my "Move" works just just fine i am just having trouble getting the "Mouse Position" binding under "PointerPosition" to work. If I put other bindings like a gamepad stick under "PointerPosition" instead, the debug log reads fine. but "Mouse Position" always reads as 0,0 with the debug log no matter how much i move my mouse while in playmode game scene.

austere grotto
#

Looks like you probably only include the keyboard in the scheme

junior phoenix
bleak roost
#

Hi Folks -

Total noob question here - apologies in advance, first time Unity user, long time 3D tools users.
Just trying to get my first 3D app running - I created a 3D scene and added a FirstPersonController for navigation. When I “play” my scene, I get only a grey background and I can’t seem to navigate around to find any of my simple (sphere) objects in the scene.

Recommendations? Troubleshooting steps? Resources for basic navigation? I'm doing something simple wrong I’m sure but this should “just work”.

#

Screenshots of my scene versus 'game' view in Play mode, is it obvious what's wrong?

austere grotto
#

The game view sees out of your game camera

#

also unless you added some code or component to control the camera, the camera isn't going to move magically

bleak roost
#

I deleted the camera per a YouTube tutorial, doesn't "FirstPersonalController" replace that?

austere grotto
#

No?

#

You need a vamera if you want to render the game

#

What is "FirstPersonalController"? Does it have a camera as part of it?

bleak roost
#

FirstPersonController is a Unity package, per the instructions and description in this tutorial:

#

Let's make a beautiful open world in just 5 minutes! In this tutorial, we make a 3D world in Unity from scratch using the built-in terrain system.

····················································································

Unity Asset Store Links:

Modular First Person Controller: https://assetstore.unity.com/packages/3d/characters/m...

▶ Play video
austere grotto
#

so it's some random asset

bleak roost
#

@austere grotto , thanks for your help. I added a camera but still same result - grey screen. I'll move it around in attempt to troubleshoot but its right at the center of the scene.

Just trying to create a very basic scene that I can navigate around, open to suggestions on the easiest/simplest way

austere grotto
#

It's unclear what's in the prefab

austere grotto
#

Why don't you just open scene view when the game is running

bleak roost
austere grotto
#

look at where your camera is

austere grotto
#

presumably you have a camera already but it was just not anywhere near your building

#

open Scene view when the game is running

#

and just look at where the camera is compared to the building

bleak roost
austere grotto
#

is this while the game is running?

bleak roost
#

Yes

austere grotto
#

ok looks like it can see the building

bleak roost
#

running, switching between view

austere grotto
#

as per the thumbnail there

bleak roost
#

thumbnails looks correct

#

Game view still grey

austere grotto
#

Well if you added a second camera that one is probably rendering on top

#

Show your camera settings?

#

this doesn't seem like an inoput system problem btw

bleak roost
#

(agreed, if there's a better channel, lmk)

#

Only 1 camera AFAIK, here are the settings

austere grotto
#

you have one inside your first person controller

#

you can type t: Camera in the hierarchy window search bar to find them all

bleak roost
#

Success! You were right, @austere grotto , I think that FirstPersonalController added a camera which screwed things up

#

Success! I can at least view the scene.

austere grotto
bleak roost
#

True, I should add a basic ground. Would love your next steps/recommendations to do very basic navigation - just move around the scene on desktop and then Oculus/Quest. Thought that the FirstPersonController was the thing, I guess not.

bleak roost
#

Anyways thanks @austere grotto, appreciate your help in getting a noob over the learning curve.

tulip tartan
#

You've enabled the events but not disbled them.

#

Depends on how you have it set up. Generally the OnDisable or OnDestroy if the object where you enabled them

#

It will be disabled, then destroyed, every time you change scenes (unless in DDOL or additive scene, which it sounds like you're using), and quit the application

#

I'm not saying YOU should disable or destroy it

#

The compiler doesn't know it.
Not really relevant. If OnDestroy isn't called, it isn't called.
The compiler just wants to see you've properly handled events

#

No one uses OnDestroy or OnEnable except unity itself.
They are Unity methods like Start, Update etc

#

Should, but I think you may have an issue with that null coalescing operator in OnEnable. Not positive though.

austere grotto
#

No reason using On destroy AND On disable

#

It's fine in this case because that's not a unity engine object

tulip tartan
austere grotto
#

Keep disable

inner anchor
#

Advices before diving into InputSystem for my game

paper dragon
#

I can't figure out why won't this work

#

void OnWalk(InputValue value)
{
Debug.Log("Move Input");

    moveTo = new Vector2(transform.position.x + (value.Get<float>() * Time.deltaTime * moveSpeed), transform.position.y);

    if (value.Get<float>() > 0) transform.localScale = new Vector3(-1, 1, 1);
    else if (value.Get<float>() < 0) transform.localScale = new Vector3(1, 1, 1);
}
#

as example the move code is this

#

I was using the old input system and at first wrote the code in unity 2017

#

when I got the project in unity 2022 character moved kinda messy but it was decent in unity 2017

tulip tartan
#

I don't see an action called Move

#

You need to rename the method to OnWalk

paper dragon
#

and when I changed the code to the new system it won't even get any input

paper dragon
#

I better edit

scarlet condor
#

Hello, so I have a retry button on my game, at first it can only be clickable by mouse click, but after clicking it once, I can now trigger the same button with Spacebar, is it because I highlighted the button upon first clicking it?

Apparently switching between the game window and another window then going back to the game window fixes the problem

slate pelican
#

you probably have keyboard navigation on, but maybe don’t have keys bound to actually move from one UI element to another

slate pelican
#

check EventSystem. Not InputSystem

scarlet condor
#

Ahh okay okay thanks

tranquil tangle
#

Does anyone know how to make the steamVR plugin work correctly? Im using Steam Link for quest 2 and i can map the inputs i made, but they dont actually function in runtime. Ive been struggling with this for a while, so any help would be appreciated

sour linden
#

I need to be able to dismount a horse (Malbers Horse Animset Pro) using a button on a vr controller. I am using the XR Toolkit and plugin that unity provides and I am able to control the horse with the VR controllers but in the MInput component I see the dismount and the mount things and they are set to keys. If I switch the type to input and try putting in the name of the reference to the button on the controller it just tells me it has no idea what I am refereeing to. I am not trying to use the unity input system but instead the XRI Defualt Input Actions which allows you to use the VR controls in unity. I have spent hours upon horus trying to do this and I am new to unity and basically everything so I only kind of know what I'm talking about.

limpid sleet
#

Hello everyone! Did anyone experience issue when changing the animation from mixamo to other mixamo animation and got warnings that the bone length does not match the position? I've switched from my idle animation to a new one, both from mixamo but I can't figure it out why I'm getting warning only for the legs. I've did this long time ago and as far as I remember, I did not have this issue. Now all the idle animation I use from mixamo i get this:

inner anchor
#
public void OnMouseOver()
{
    if (EventSystem.current)
    {
        if (!EventSystem.current.IsPointerOverGameObject())
        {
            if (GetGamePlane())
            {
                if (!IsHovering)
                {
                    IsHovering = true;
                    OnInteraction(InteractionState.BeginHover);
                }

                if (Input.GetMouseButtonDown(0))//Left click
                {
                    OnInteraction(InteractionState.LeftClick);
                }

                if (Input.GetMouseButtonDown(1))//Right click
                {
                    OnInteraction(InteractionState.RightClick);
                }

                if (Input.GetMouseButtonDown(2))//Middle click
                {
                    OnInteraction(InteractionState.MiddleClick);
                }
            }
        }
    }
}

public void OnMouseExit()
{
    if (GetGamePlane())
    {
        if (IsHovering)
        {
            IsHovering = false;
            OnInteraction(InteractionState.EndHover); //This just invokes the event passing this and the state
        }
    }
}

I'm switching to InputManagerSystem on my prototype. It's an rts and these to method are handling the hidden hexgrid below the plane of the game. Right now it is working with the old input system but I have to think about a way to make a controller work. Since I either add a pointer that you control but that doesn't sounds intuitive for gamepad, or these methods are only viable for mouse and the controller user can only select 4directional input to navigate the plane. Any suggestion? Hope I was clear. Is EventSystem.current.IsPointOver working with new Input system too or should i find an alternative?

austere grotto
#

My recommendation is to delete this entirely and just use the built in event system and corresponding events

inner anchor
#

and for entering and exiting gameobject with mouse do IPointHandlers?

#

and handle gamepad differently?

austere grotto
#

As long as you have an event system in the scene and a PhysicsRaycaster, and the object in question has a collider, you can use the IPointerXXX and other event system interfaces, yes.

austere grotto
inner anchor
#

I need to check it

austere grotto
#

which will work directly with this same system

inner anchor
#

Maybe I can use it for now, like a virtual mouse icon. But probably change the feel of the game

austere grotto
#

Kinda depends what behavior you want

inner anchor
#

I have to get a feel for it on the go i think. I'll go with virtual so both behave the same for now 🙂

vale raptor
#

with the new input system how can i tell if a controller is being used

vale raptor
#

because i setup a virtual mouse and i only want to activate it if a controller is being used

pseudo axle
#

Hello, I have a problem with the InputAction.CallbackContext, it's in my script, but when I try to choose it on unity, there is not here, someone know why ?

austere grotto
#

The first thing to check is the console window to see if you have any compile errors

pseudo axle
#

Problem solved, I was in the wrong event window

zealous solar
#

Hi, I have a strange problem with the new input system, if I touch rapidely the screen, it just set the press to 1 and then get stuck like this.

zealous solar
#

If my eyes are seeing correctly, it look like there is some frame dropping right before the input is getting stuck

zealous solar
#

Anyone have an idea?

zealous solar
#

it also seem to affect only the editor, not in the build

vernal garden
#

i got an onclick event on an image - i have enabled raycasts for the target image and disabled all raycasts of children, but no event seems to be fired when i click an image... does anyone know why?

#

also there's nothing drawn ontop of the triggering image, i'm kinda clueless now

austere grotto
vernal garden
#

Yess

austere grotto
#

Show the console window and the inspector for the event system

vernal garden
#

the method thats called on click currently only debug.logs a test message but isn't called at all

austere grotto
#

Ok I recommend leaving that event system inspector open while running the game and see what it says when you mouse over the image

vernal garden
#

ohh i just saw there are dev tools under the event system

#

yup that solved it

#

tyvm!

manic dirge
#

Is there a way to get these key names as int values through CallbackContext? I've tried ReadValue<int> and <float> but I only get 1 as a return;

input.Player.Hotbar.performed += ctx => Debug.Log(ctx.ReadValue<int>()); // How can I get 1, 2, 3?
manic dirge
#

I found it, ctx.control.name or .displayName

zealous solar
austere grotto
manic dirge
#

I see. Normally, this is exactly what I would do but it just seemed clunky. I’ll do this next time as it’s working for me

austere grotto
manic dirge
astral tartan
#

does anyone know why the new input system (version 1.3.0 on 2021.3.4f1) stops reading inputs when a script compiles? I don't like having to restart the scene when I make edits to my scripts. when i check the input debugger, it says input is still being recorded, but when I try reading it from a script it just stops working. also, the old input system still works (at least the mouse position reading does)

supple crow
#

I want my game to properly support the Steam Deck. This means I need to be able to combine both joystick and gyro input.

#

the Deck is providing gyro input as mouse movement

#

If I make both Delta [Mouse] and Right Stick [Gamepad] part of the "Gamepad" control scheme (which includes a required gamepad and an optional mouse), I can indeed use both the mouse and the joystick in game...but it's not a great experience. It's very jittery.

I'm getting that input by doing action.ReadValue<Vector2>().

#

I already have the Delta [Mouse] binding set up to use cinemachine's DeltaTimeScsaleProcessor, which divides by unscaledDeltaTime so that I can scale both mouse and joystick input by unscaledDeltaTime later

#

(so that's not relevant)

#

I guess I'm just wondering how I'd sum up these two separate inputs properly. It looks like I'm only seeing one binding's value at a time when using ReadValue

#

I do need to do some testing though.

#

I could just use two actions, if all else fails

supple crow
#

only after the stick moves does it start turning again

supple crow
#

I wonder if you could create a composite that combines the inputs from two bindings...

surreal moth
#

Im trying to use the virtual mouse cursor package example included with the new input system to make my own virtual cursor

#

but I cannot make heads or tails of Unity's code

#

what is critical that allows their virtual cursor to interact with canvas UI and how do I extract that into my virtual cursor?

#

their raw class is massive and full of comments that make it completely opaque and impenetrable, nothing just says what it does in a way that something dumb like me can comprehend. I need help

#

im not experienced enough to know what does what or what is neccessary and what is not, and ive tried to blindly delete my way through it, strip out everything until it only does the one and only thing I need to take from it, but it just keeps breaking long before I get there

#

and tutorials online didnt help to make a virtual cursor either

#

here is unity's code with most of the opaque comments stripped out

#

still trying to find JUST the parts that do what I need

#

it doesnt help that theirs is trying to multiple things all at once, like support both hardware and software mice

#

so I cant even tell what is related to which of the two mice

#

I cant even test any of it easily because it ONLY works if you use analog sticks, it wont react to the UI if you just drag the cursor object over top of the UI element

#

so I cant even remove any of that confusing code either

#

there's just too much shit in there making it impossible to understand, even though almost none of it relates to what I need or am trying to do or get from it 😿

supple crow
#

I've glanced at that code and decided I'm going to look into it Later

viscid bramble
#

and the game is a 3d game so im not sure if that has anything to do with it

#

any help is appriciated

silk parrot
#

I'm having trouble with my events not getting invoked depending on which other actions are active. In the worst case I found, I'm unable to walk diagonally forward-right (all other diagonal directions work..) and crouch. The event itself for the crouch action is never invoked at all while walking forward-right. This is the callback from the auto generated interface, no intermediate layer I might have messed up. It also works fine when I'm walking forward, or right, or forward-left or backward-right. Just not when walking forward-right. On the flip side, I'm also unable to walk forward-right while I'm already crouching (but I can walk in all other directions). What's the issue here?

surreal moth
#

I am trying to debug stuff related to the input system

#

but visual studio cant find any of the code related to the input system for some reason

#

when I hit F11 to advance in the debug, it brings up this frame not in module error

#

and its making it really hard to figure out why the code isnt doing what I think it should be doing because I cannot trace its full path

#

how do I fix the path/access/whatever is going on here?

surreal moth
#

I am extremely stuck trying to code this virtual cursor

#

ive started over from scratch fives times

#

ive boiled down every variable to the absolute minium essentials

#

and its just not working, nothing works as expected, it keeps doing all kinds of insane shit

#

and I dont comprehend any of it

#

and i desperately need help

#

and I feel like if anyone who was as desperate as I am for help came to me, I would drop everything and help them in an instant
but I dont ever command that kind of authority, that kind of human kindness in anyone else
ive never once felt like I can ask for help and am treated as a human being, I am treated as a nuisance, I get help only begrudingly, because I am annoying and they want me to go away, because I am saying or doing hurtful things
its so fucking frustrating to be stupid and useless and to KNOW im stupid and useless but still have dreams and goals and try my fucking hardest to achieve one tiny little flicker of greatness and nothing ever works

#

I really really really just need your help, you, your help

#

please help me with this

#

all i can do is beg and grovel and put myself down and do everything i can to deserve to be helped, to ingratiate myself

#

I need a virtual cursor, I need a cursor that is not the system cursor, that otherwise operates like a real cursor, in every possible way

#

i cannot get that to work

#

ive tried packages, ive tried the unity example asset

#

it just is wildly unstable, it suddenly stops working, it suddenly remaps itself

#

no actions are set yet it fires off actions

timber robin
#

Once again, please stop going on these long monologues, you've been told this before.

#

If you're struggling with something, take a break. Try to find a tutorial. Try to clearly explain what you're doing, rather than posting Unity's own code. You shouldn't need to be diving into their locked scripts to use their features.

#

Have you tried any of these tutorials?

surreal moth
timber robin
#

And what's the actual issue, it's not moving? It's not registering clicks? It's throwing errors?

errant sandal
#

i have a simple doubt

#

this is the "new" input system?

#

being the built in the "old"?