#🖱️┃input-system

1 messages · Page 33 of 1

charred swallow
#

I'm trying to detect clicks on squares on my chess board with IPointerClickHandler, I assigned the script that had the interface thing and a BoxCollider2d to the square game objects, I have an event system in the scene, there's a Physics2dRaycaster, but it still doesn't work

#

am I missing something here?

#

if you can help me ping me please I'm gonna continue trying to fix this

charred swallow
solar plover
#

Maybe something is blocking the way

charred swallow
solar plover
#

You should probably show your scene hierarchy

charred swallow
simple vortex
#

I have no problem with OnMouseDown()

solar plover
#

Does it work if you deactivate the pieces?

charred swallow
#

what works

#

sorry what do you mean by it

solar perch
#

Hello everyone hope all is well.

solar plover
#

I'm going to assume the pieces are blocking the squares

charred swallow
#

sorry I misunderstood

#

I thought you asked me to deactivate the squars

#

when I deactivate the pieces it still doesn't work

solar perch
#

I was wondering if anyone could give me some clarity.

Long story short, I updated project from 2021 to unity 6. And I’m running into some kinks.

simple vortex
#

Use the IPointerClickHandler Interface to handle click input using OnPointerClick callbacks. Ensure an Event System exists in the Scene to allow click detection. For click detection on non-UI GameObjects, ensure a PhysicsRaycaster is attached to the Camera.

charred swallow
solar plover
#

Can you show the inspector for the square and piece?

charred swallow
#

forgot the bottom part of the square GO in the inspector

solar perch
#

I’ve read documentation and watched official videos on input system.

It doesn’t explain any relationship between the player input component and action asset.

I had both working before updating.

#

I also don’t understand the UI folder beside asset. I haven’t been able to find info on it

charred swallow
#

I adjusted the size of the BoxCollider2D on my squares and it works as intended now

solar plover
charred swallow
fierce compass
#

mine was basically the same thing praetor just told you to do

#

you never gave any feedback

#

you just ignored it

#

you never showed issues when you actually had the setup correct

#

you definitely asked way more than twice

plucky pecan
#

Is inputactionmap better than inputactionreference

#

Cause can I just map[0].action[1]?

#

From memory

verbal remnant
# plucky pecan Is inputactionmap better than inputactionreference

you cant directly serialized a reference to an action map, but you can always access the action map from a input action reference. maps are for grouping actions and enabling/processing them as such. you don't ever use positional indexes in your input discovery (they will break), if you can use a stable direct reference like an input action reference.

olive mason
#

hi guys im making a weapon bench in my game when u enter it switches the input map but when i try using it nothing happens no errors no debugs that its null even tho i enable them all
`var values = playerGeneralValues.Instance;
if (values == null)
{
Debug.LogError("playerGeneralValues instance is null!");
yield break;
}
values.playerInput_i.Enable();
// Get and enable the weapon bench map
weaponBenchMaps = values.playerInput_i.weaponBenchMap;
if (weaponBenchMaps == null)
{
Debug.LogError("Weapon bench map is null!");
yield break;
}

    weaponBenchMaps.Enable();
    
    // Find actions
    leaveAction = weaponBenchMaps.FindAction("leaving");
    clickAction = weaponBenchMaps.FindAction("click");
    mousePositionIA = weaponBenchMaps.FindAction("mouse");
    
    // Verify actions were found
    if (leaveAction == null) Debug.LogError("Leave action not found!");
    if (clickAction == null) Debug.LogError("Click action not found!");
    if (mousePositionIA == null) Debug.LogError("Mouse action not found!");

    // Enable actions
    leaveAction?.Enable();
    clickAction?.Enable();
    mousePositionIA?.Enable();`

i am not using a player input component

#

i am not receiving any input

#

`if (playerInput_i == null)
playerInput_i = new PlayerInputs_im();

    playerInput_i.defaultMap.Enable();` this is what i use to get input system
cobalt mossBOT
olive mason
#

hi guys is there a way to disable all action maps in the same time from and input asset? in code

olive mason
austere grotto
sick quest
#

@austere grotto Should I continue here?

latent cave
#

'PlayerInput' does not contain a definition for 'actions' and no accessible extension method 'actions' accepting a first argument of type 'PlayerInput' could be found (are you missing a using directive or an assembly reference?)

#

i dont know why its not working guys

#

it worked on a different project

#

but now i dont know why this error is showing

austere grotto
#

There's a built-in component in the input system called PlayerInput that your name is conflicting with

#

You have a few options to resolve it:

  • Rename your actions asset
  • Disable "Generate C# class" on the asset
  • Use the fully qualified type name here
wraith elm
#

Hey, I have a problem with my input settings that I am not able to use my mouse to control the Pitch and Yaw direction with my mouse, I've tried diff tutorials on youtube but many of them have a outdated version of the Input controller so I duno if there are like any minor changes that I mustve missed

austere grotto
#

What happens when you try?

#

You should also show the configuration of the PitchYaw action itself

wraith elm
#

sorry, here you go. but atm nothing happens, when I move forward and try to use my mouse it doesn't follow

fierce compass
cobalt mossBOT
fierce compass
#

huh..

#

!code

cobalt mossBOT
austere grotto
#

Can you show that control scheme?

fierce compass
#

it seems like you're applying deltaTime to the mouse input

#

but it's kinda hard to track with the file

austere grotto
#

Yes not only that but you're treating the input like a joystick that remains actuated permanently after receiving a certain input. Mouse delta doesn't work that way

#

But the biggest problem I think is that you're using control schemes meaning it's probably binding your PlayerInput to certain devices not including your mouse

#

If this is not a local multiplayer game my usuall recommendation is to avoid control schemes entirely

wraith elm
austere grotto
#

I see something called "New Control Scheme" in your screenshots

#

And your mouse binding here is not included in it

wraith elm
#

ahh you mean that, It's probably from another input controller

#

unrelated at least

austere grotto
#

I'm not sure what you mean by that

wraith elm
#

idk how it's showing up, at least it's empty for me

fierce compass
#

the "new control scheme" is there

wraith elm
#

ooh

#

It's the Global one

fierce compass
#

i don't think there's a concept of global control schemes

wraith elm
#

honestly I don't remember how it even got there

#

but regardless it seems just like the same settings

#

Okay. So the problem was the "new control scheme", just deleted it and it worked all the sudden haha

#

Minor mistake that just went over me, thanks for helping out!

wraith elm
#

just trying to understand what it was

#

or what it did

austere grotto
#

they're really there for local multiplayer

#

when you have one, the PlayerInput will essentially grab some input devices based on the control schemes and ignore all other devices

#

hypothetically these devices would be available for other PlayerInputs in a lcoal multiplayer situation

#

but if you're not doing local multiplayer it just leads to annoying confusion like this

#

iumagine like - player1 gets a controller, player2 gets keayboard + mouse

wraith elm
#

aaaah I see, well I am for sure not gona do any muliplayer related anyway so it's good to know that I can just avoid that feature for now

#

thank you sir

civic gulch
#

I have an issue where unity stops reading inputs from a control scheme and switches to the other one, I have two control schemes (Keyboard, Gamepad) and they both work on play, but after my death and respawn functions run (Instantiates a new player object, destroys old one) I stop recieving inputs from the most recent one. If my player dies while using keyboard, after the respawn keyboard inputs don't do anything and the active scheme switches to gamepad despite there being no input on that scheme. Does anyone know how to fix this?

#

actually never mind, I just stopped trying to use control schemes and it works. is there a way to find what the most recent input device is?

#

nvm found documentation lol

austere grotto
#

the new one gets treated as a new human player by the input system and it tries to assign it an unused set of input devices

#

If you're not doing local multiplayer I recommend not using control schemes at all

coral jasper
#

a very specfic question , as u see, here is a grid plan with many buttons

because im planning to make smartphone apps, so i had implmented zoom feature for the plan map, however, the only problem is, how to safely detect if two fingers are inside the plan map area only?

#

currently im implementing my own gestures using enhanced touch

#
public static float ZoomAction(this InputManager manager)
{
    if (Touch.activeTouches.Count < 2)
    {
        return 0; //single touch , ignore
    }

    Touch touch0 = Touch.activeTouches[0];
    Touch touch1 = Touch.activeTouches[1];

    if (touch0.phase != TouchPhase.Moved && touch1.phase != TouchPhase.Moved)
    {
        return 0;
    }

    if (touch0.history.Count < 1 || touch1.history.Count < 1)
    {
        return 0;
    }

    return <calculated results>
}```
coral jasper
#

i used a better solution than raycasting

#

problem solved

stone orchid
#

Is it worth to change from "Send Messages" to invoke C# Events?

austere grotto
#

Wdym by "worth it"?

#

Pick whichever workflow you want to use

stone orchid
#

But I heard that Send messages is just worse Invoke Unity Events

austere grotto
#

it's alright for fast prototyping

stone orchid
#

KK Ty

next lily
#

I'm hitting such a wall with splitscreen UI. I'm very close, the mouse and gamepad will both hover their respective UIs correctly, but the "submit" UI action just isn't causing the button to submit for some reason (on both mouse and gamepad).

Is there anyone that has done this before that can help? I'm not even sure what screenshots to drop here because there's a lot of UI going on. I'd be happy to jump on a call or something or provide any screenshots. Thanks!

neon burrow
next lily
#

Turns out I did set everything up correctly and it's working now. For those wondering how to make it work, this is the tutorial I followed:
https://www.youtube.com/watch?v=81GecyuNapg

My issue came from migrating some of my UI, which removed the button listeners, so it was working this whole time just the buttons weren't told to do anything 🤦‍♂️

In this video we will use the Multiplayer Event System from the new Input System in Unity to separate the UI for local multiplayer games.

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

If you want to learn how to set up local multiplayer with the new input system, you...

▶ Play video
next lily
vale zodiac
#

deos someoen know why when i enetr unity project the input system widnow doesn't hswo everything and it is so buggy and i need to run the game while openeing the window to make the bug go ?

austere grotto
vale zodiac
#

before running the game

#

after runnign the game

clear stump
#

I want to be able to:

  1. When there is only one player, switch between gamepad and keyboard/mouse whenever the player wants.
  2. When there are several players, at specific times, be able to say that a particular controller for a particular player should be activated and not the others.
    I already disable the “Joining Enabled By Default” option outside of my hub.
    How do I do these two things?
sturdy sleet
#

guys i need a bit of help here

#

so i am using send message

#

and the action is set to value

#

but when i click on the button, the event only gets called once

#

it need it to be called as long as the button is hold

fierce compass
#

every frame?

#

well, you can use a press & release interaction and save the state yourself

#

i don't think value events are called every frame anyways, only when they change, though i might be wrong on that

sturdy sleet
#

i know but i prefer if it got called every frame

fierce compass
fierce compass
fierce compass
lyric cairn
#

Helloooooo. I was having trouble with setting up some controls. I'm using the Input System but I can't get my button input to only return true on the frame I start hitting the button. I've read a lot of documentation, but nothing seems to work.
Same for when I release the button.
I'm trying to figure out 2d platformer movement and most platformers I see have it so holding the button doesn't buffer, only pressing.

#

started seems to do absolutely nothing.

marsh garnet
lyric cairn
#

I actually have been looking through that and trying a bunch of started, performed, and cancelled for various interaction properties.

#

It was good information, but it never worked how I thought the documentation said it would work

#

WasPressedThisFrame also seems to not work

#

It just activates every frame

marsh garnet
#

you should add some logging in there which should clarify what's happening

lyric cairn
#

Like debug code?

marsh garnet
#

I assume you put WasPressedThisFrame into your jump callback, so it should always be true

#

you're missing some concepts and not debugging very effectively. If you log the above code, I would expect context.started to always be false because those actions weren't started, they were performed

lyric cairn
#

Got it. I understand.

#

Am I just misunderstanding how these actions work and in reality I should just write some code that sets a variable to true for only one frame?

#

I'll start debugging more

marsh garnet
#

well presumably you have something else setting jumpInput false right? If it makes more sense to you to use polling instead of events, that's perfectly fine too

#

performed should solve your problem as-is though

lyric cairn
#

Fair.

#

Weird. When I hold down the button with started it is both true and false on the same frame.

#

I'm not as use to the debugging system for unity since I'm more use to other languages. Thanks for the tips.

marsh garnet
#

the context is first started, and then immediately (because the control has no button press threshold) performed

lyric cairn
#

Okay, I think I'm starting to understand more.

lyric cairn
#

Thank you for the help

#

I'll just write a bunch of code to do the one frame check for me.

#

Because as far as I can tell, the input system can't do that.

#

Or not...

marsh garnet
#

you can poll if you absolutely need to, but most of the time a one frame check isn't useful except to set an enabled flag which you can already do with your existing code like this
jumpInput = jumpInput || context.performed;
Otherwise, if you're consuming input in physics updates, you'll need to change the update mode or risk missing input events

lyric cairn
#

Okay, sorry if my stuff is exhausting. I'm just really confused.

#

I'm just trying to figure out how to make a button only read true for one action and not repeating the same action over and over again.

marsh garnet
#

is your character physics-based? if yes, use above snippet and consume the jump input during fixed update. If no, why have jumpInput at all? just run logic immediately

lyric cairn
#

By physics-based do you mean do I have a rigidbody component?

marsh garnet
#

are you doing movement in FixedUpdate?

lyric cairn
#

I'm doing movement in Update

marsh garnet
#

does that movement involve physics forces?

lyric cairn
#

I guess that would be yes. I'm using AddForce to do acceleration.

marsh garnet
#

then unless you're using one-time impulses, you should probably move that into FixedUpdate and either use the strategy I mentioned or change the input system update mode

lyric cairn
#

Oh, I didn't realize it'd be useful to update the player on a fixed time interval.

marsh garnet
#

if you don't, then depending on how your movement works, it'll either be unstable (if you're modifying force by delta time) or frame rate dependent

lyric cairn
#

Okay, I just looked up a video to better understand.

#

I really wanna thank you for your help. This was a good dive into the logic. I really appreciate what you did.

languid falcon
#

Hello guys, im a learning Game Dev and am currently working on getting Touch inputs for a mobile game. How do I implement a Stick with the legacy input system, that when i move the stick, he rotates?
Anyone know a good tutorial for that? Or have Code snippets to show? Thanks in advance

rigid raft
#

you dont need he new Input System for on screen joy stick

#

it works fine with legacy

#

if you want some tutorial @languid falcon

languid falcon
#

Thanks, i found a way to do it with either recttransform or screentoworldpoint

rigid raft
#

np

#

good luck with ur game

#

sounds like a banger

languid falcon
#

tyty

neat shard
#

Hello, I wanted to ask a quick question on input/player movement. I was doing the 2D beginner tutorial (Sprite Flight) where when you click, a little ship accelerates towards where your mouse is by using AddForce on the rigid body.

My question is: how come we don't multiple the force vector by delta time? Won't this mean that if the fps is higher, more force will be applied per second and therefore the acceleration is higher?

austere grotto
#

The correct way to do it would be in FixedUpdate, and then it doesn't matter what the framerate is

fierce compass
neat shard
fierce compass
#

was there a forcemode? 🤨

neat shard
fierce compass
#

i guess that's a no

#

that would mean the tutorial is wrong

neat shard
#

Really?

#

Maybe I'm just unaware of what mode it's in

fierce compass
#

you'd probably be able to tell

neat shard
#

If I get time later I can link the tutorial

#

As far as I know, the tutorial just applied AddForce onto a rigid body 2D and called it a day

#

I'm not at my pc right now but I'll double check when I can

fierce compass
#
// 3D
AddForce(x); // ForceMode.Force by default
AddForce(x, ForceMode.Force);
AddForce(x, ForceMode.Acceleration);
AddForce(x, ForceMode.Impulse);
AddForce(x, ForceMode.VelocityChange);
// 2D
AddForce(x); // ForceMode2D.Force by default
AddForce(x, ForceMode2D.Force);
AddForce(x, ForceMode2D.Impulse);
neat shard
#

Oh okay so it should be on by default

fierce compass
# fierce compass ```cs // 3D AddForce(x); // ForceMode.Force by default AddForce(x, ForceMode.For...

the Force or Acceleration modes are "continuous" modes, meant to be called multiple times for a continuous force
the Impulse and VelocityChange modes are "instantaneous" modes, meant to be called once per some action

since Impulse and VelocityChange are instantaneous, deltaTime doesn't matter, they can be used in any cycle
but Force and Acceleration account for deltaTime internally, and they expect to be called in FixedUpdate. calling them on a different cycle (like Update) means you'll get inconsistent results.

-# (Force and Impulse consider mass, Acceleration and VelocityChange don't)

austere grotto
#

To be strictly correct forces should only ever be added in FixedUpdate and deltaTime should never be multiplied into it

#

You can get away with one-off forces in Update though.

neat shard
#

Sorry I was only able to send this now, this is the tutorial I was referring to

neat shard
fierce compass
#

yeah

terse pond
#

So Input.mousePosition and mouse.ReadValue<Vector2>() give the same readings correct?
playerControls.PlayerMovement.Look.performed += i => mousePos = i.ReadValue<Vector2>();

 Vector3 look = Camera.main.ScreenToWorldPoint(inputManager.mousePos);
 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
 RaycastHit hit;
 if(Physics.Raycast(ray, out hit, maxDistance: 500))
 {

     lookPos = hit.point;
 }
 Vector3 lookDir = lookPos - transform.position;
 lookDir.y = 0;

 Quaternion targetRotation = Quaternion.LookRotation(lookDir);
 Quaternion playerRotation = Quaternion.Slerp(transform.transform.rotation, targetRotation, playerControlData.rotationSpeed * Time.deltaTime);
 transform.rotation = playerRotation;```
The above code works fine. But when i try to use look to control rotation nothing works no matter where i implement "look" . What am i not seeing.
austere grotto
terse pond
#

Vector3 lookDir = look - transform.position;
tried replacing the raycast

austere grotto
#

I mean how did you set up the look action in the actions asset

#

Not the code

terse pond
#

Sorry its 1am and very tired let me read again

#

Honestly probably should look at a tut instead im working this out kinda with things i know

austere grotto
#

Ok - for this I do recommend using a Passthrough action but it's otherwise alright

#

But your code is not using this from what you showed above

#

And "doesn't work" is pretty vague. What's actually happening? And maybe show the full script

terse pond
#

no thats the current working method but not to my liking. when i change to Vector3 lookDir = look - transform.position; the character doesnt even try to look around

austere grotto
#

Sorry is this an input question or a question about your look logic

terse pond
#

thats where im not sure

#

i wasnt sure if i am doing the input right or if its my logic

austere grotto
#

ScreenToWorldPoint is not going to be equivalent to that whole screen point to ray and Raycast setup you have

#

You're not doing a 1-1 comparison here

terse pond
#

Ope didnt see i still had that as WorldSpace

#

Wait yes. I want to be able to look around without the use of ray. So what with the system needs changed to use WorldSpace

austere grotto
#

Just feed the new mouse position through the same process as the old

#

Why are you changing the whole process?

#

That's not an input system issue then, you're changing the code entirely

terse pond
#

okay let me try using what i ahve to passing the new mouse pos

#

so i changed Ray ray = Camera.main.ScreenPointToRay(inputManager.mousePos); now it will not turn at all. Maybe im not understanding you correctly

austere grotto
#

Print out Input.mousrPosition and the mousePos variable

#

Make sure they are both working as expected

#

They should print the same value

terse pond
#

print(Input.mousePosition + " " + inputManager.mousePos);

#

Not the same

austere grotto
terse pond
#

FixedUpdate => ``` private void HandleRotation()
{
Vector3 look = Camera.main.ScreenToWorldPoint(inputManager.mousePos);
print(Input.mousePosition + " " + inputManager.mousePos);
Ray ray = Camera.main.ScreenPointToRay(inputManager.mousePos);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 500))
{

     lookPos = hit.point;
 }
 Vector3 lookDir = lookPos - transform.position;
 lookDir.y = 0;

 Quaternion targetRotation = Quaternion.LookRotation(lookDir);
 Quaternion playerRotation = Quaternion.Slerp(transform.transform.rotation, targetRotation, playerControlData.rotationSpeed * Time.deltaTime);
 transform.rotation = playerRotation;

}```

#

playerControls.PlayerMovement.Look.performed += i => mousePos = i.ReadValue<Vector2>();

austere grotto
#

That's your issue

terse pond
#

Still the same issue even when called from Update()

#

Nothing is now running in fixed everything was moved to Update

#

also changed to pass through btw

#

thanks for that

austere grotto
terse pond
#

let me check

#

That reads perfect

#

is that part of the new system?

austere grotto
#

Yes

terse pond
#

That works

#

Now to see how i can work with Camera.main.ScreenToWorldPoint

austere grotto
#

Either Physics.Raycast or Plane.Raycast are the way to go, with ScreenPointToRay

terse pond
austere grotto
#

Because it doesn't make sense for what you're trying to do (from what I can tell)

#

Is there a reason you want to stop using Raycast?

terse pond
#

Mainly just seeing if their is a way to eliminate the use of it.

#

now i have one last question how would i set up a input in the new system for Mouse.current.position.ReadValue()

#

Add it to here

austere grotto
#

My understanding is that Mouse[position] should have done it

terse pond
#

weird

#

they dont read the same when debugging

#

Mouse.current.position.ReadValue() works perfect and returns the same as Input.mousePos but
playerControls.PlayerMovement.Look.performed += i => mousePos = i.ReadValue<Vector2>();
mosPos reads nothing right

#

let me try something

#

nope that didnt work

terse pond
#

Well going to sleep. Still havent figured this fully out the way i want it to work

terse pond
latent tangle
#

Hi, everyone!, i am having a problem when using gamepad sticks for movement/look, when i constantly hold the stick at a still position the input received is not continous, it's like
(0.5, 0),
(0.5, 0),
(0, 0),
(0.5, 0)
(0.5, 0)
and this loop keeps going on the bad frame (0,0) doesn't always come only once, it sometimes comes 2-3 times, my question is why is this happening, it happens in the starter assets third person controller as well (i checked it to be sure), this causes a very bad effect, it rotates the cam then stops for a few ms then rotates then stops...... and on and on,
i am using a PS4 controller connected to my mac using bluetooth,

#

this is very annoying, as it causes a start stop effect instead of continous movement/look

fierce compass
#

also check the input debugger perhaps

#

also make sure you aren't polling in a fixed time step

latent tangle
#

will do

#

i have a ps4 controller that isn't like the original ps4 controllers, it seems to be a modified one, it has USB-C instead of the USB which was the default for PS4 controllers i originally had, so the original one seems to be better for some reason so i was using that now, but let's see what the gamepad tester says for the modified controller etc, also couldn't get it to connect wired to my mac, the original one allows both wired/wireless while the other one doesn't (only wireless)

#

for some reason

latent tangle
#

funny, it's soo bad,

#

while the original one is super stable

#

ok so i guess we can't do anything to fix this

#

though it seems to work fine with PS4 games e.g. over cooked 2

#

doesn't show any jitter there in the game

#

btw ty @fierce compass

chilly anvil
#

from having this code:

public class Player : NPC
{
    bool PressedJump = false;
    Vector2 MovementInput;
    NPC NPC;
    NPC NPC2;

    void Awake()
    {
        NPC = this;
    }

    void FixedUpdate()
    {
        Debug.Log(NPC2 == NPC); // false, NPC2 stays null
    }

    public void Move(InputAction.CallbackContext context)
    {
        NPC2 = this;
        MovementInput = context.action.ReadValue<Vector2>();
    }
}

im noticing that the function Move is not referring to the same living instance in the scene (there is only 1 Player). yet there is nothing else to reference (shown in the image). am I missing something? I've looked all around, all tutorials do not use prefabs, and I've been having issues with both methods (even with just setting a public InputActionReference). would like advice.

fierce compass
#

oh, are you assigning the prefab in the callback..

#

it's not that Move is referring to a different instance, it's that you're referring to Move of a different instance

#

don't use that selection menu

#

drag the player in the hierarchy (or even one of the components in the inspector) into that slot

#

the selection menu will show assets, that's probably not what you want

chilly anvil
#

so from there? @fierce compass

chilly anvil
chilly anvil
#

got it working with Send Messages and Invoke C Sharp Events

fierce compass
chilly anvil
#

once FixedUpdate rolls around, the MovementInput is 0, 0, 0, when it was 1, 0, 0 before inside of OnMove

#

i can grab the hash maybe if that makes it more clear

#

or just the actual reference

fierce compass
# chilly anvil

it seems like you're grabbing the wrong object here. not sure why

#

oh wait hold on

#

yeah grabbing the prefab asset and the prefab root in the scene are different

#

so what you did there should work

#

have you tried just logging Debug.Log("Awake/Move", this) etc in Awake and Move, and see what objects those point to

chilly anvil
#

k lemme go back to Invoke Unity Events

#

cool it works now. 0 clue why.

fierce compass
#

i mean, it seems to me that the debugger was also showing it working fine

#

NPC was set when you broke in OnMove. Awake wouldntve been called if it were in the prefab

#

then in FixedUpdate, NPC2 was set as well

#

the MovementInput was set to 0 for both, probably because another OnMove was called before the FixedUpdate

#

though, btw, fields should generally be in camelCase, not PascalCase
you probably shouldn't have a field Rigidbody or Camera shadowing the type names.

chilly anvil
#

ehh, i guess its fine, renamed it

#

though, btw, fields should generally be in camelCase, not PascalCase

not a field, i usually just pascalcase out of habit. i dont like thinking too much about style conventions

fierce compass
chilly anvil
fierce compass
#

you do need to check canceled as well

chilly anvil
fierce compass
#

that's what happens when the input is released

fierce compass
chilly anvil
#

or attribute

#

i did it before and it didnt show up, i can show it again

fierce compass
#

[field: SerializeField] lets the attribute target the backing field

chilly anvil
#

oh wtf

fierce compass
#

so you could have something like [field: SerializeField] public Rigidbody _Rigidbody { get; protected set; }

chilly anvil
#

wait

#

what c# version can u go up to with Unity

#

Mar 18, 2025 — Officially Unity only supports up to C# language version 9.0. Sure you can force it up to 10.0 or whatnot, and some things may work. But if they

fierce compass
#

you have get as autoimplemented but set as not

chilly anvil
#

okay ima just do it the other way since i usually like to have getter/setter logic eventually

#

for example, CurrentHealth

fierce compass
#

this is a feature that unity's version of c# doesn't have

public float prop {
  get => field * 2;
  set => field = value / 2;
}
```using the `field` keyword in accessors to refer to the automatic backing field
chilly anvil
#

oh okay

#

thanks

#

quick question while u are here: @fierce compass

fierce compass
#

just ask instead of pinging me and making me wait lol

#

no need to ping me for a new question in the first place lol

chilly anvil
#

how do u make it so that the player script is actually following the NPC script?

#

these arent the default values

#

from NPC Script

fierce compass
#

not sure what you mean by "follow"

chilly anvil
#

from NPC Prefab

#

do i just have to hardcode some values in NPC script?

fierce compass
#

you still haven't said what you mean by "follow"

#

is Player inheriting NPC or something?

chilly anvil
#

ya

fierce compass
#

well, that'd mean you'd have to remove the NPC component and replace it with the Player component

#

unfortunately unity doesn't really do inheritance with components well

#

usually i just use composition in this sort of situation instead

chilly anvil
#

okay should i keep inherited items in code then

chilly anvil
#

to have just as a baseline for stats

#

wanted to just do them in the editor

fierce compass
#

you can use the Reset message to grab the values i guess

chilly anvil
#

so if any inherited scripts never changed a field, they get updated as well

fierce compass
#

using composition instead fits more into unity's model

chilly anvil
fierce compass
#

the defaults would be in NPC, Player wouldn't specify any of these values, it'd grab them from NPC

chilly anvil
#

okay i should def. move this off, this wont work like this

#

im not even sure why they showed up since it only shows up in NPC

#

i mean ya there isnt much here

#

i didnt think much of it tho

#

k im guessing you cant tbh

#

okay ik what to do now

#

im removing the script from NPC prefab. thanks.

inland quail
#

I need a medic!!!

#

I am physically unable to disable my action input . no matter what I try .. This is what I have tried

        public void DisableInput()
        {
            if (_playerInput != null)
                _playerInput.currentActionMap?.Disable();
            
        }
       public void DisableInput()
        {
            if (_playerInput != null)
                _playerInput.DeactivateInput();
            
        }

      public void DisableInput()
        {
            if (_playerInput != null)
                _playerInput.enabled = false;
            
        }

None of them work

#

I can still move my character about during a cutscene

#

This a tiny snippet of my input class

    public class PlayerInputV2 : MonoBehaviour
    {
        #region Inspector

        [Header("Action Map Names")]
        [SerializeField] private string playerMap = "Player";
        [SerializeField] private string uiMap = "UI";

        #endregion

        #region Runtime

        private PlayerInput _playerInput;
        private readonly Dictionary<InputAction, bool> _toggleStates = new();

        // continuous
        public Vector2 MoveInput { get; private set; }
        public Vector2 LookInput { get; private set; }
        public Vector2 DPadInput { get; private set; }
        public float AimInput { get; private set; }
        public float AttackValue { get; private set; }

        public string UiActionMapName => uiMap;
        public string PlayerActionMapName => playerMap;

        #endregion

        #region Unity

        void Awake()
        {
            _playerInput = GetComponent<PlayerInput>();
            ValidationUtils.CheckNull(_playerInput, this, "Player Input");
        }

        void OnEnable()
        {
            PlayerEvents.PlayerStateChanged += SwitchActionMap;
            UiSignals.OnUiStateChanged += OnUiStateChangedMap;

            // cutscene input handling
            UiSignals.OnEnterCutscene += HandleCutsceneStart;
            UiSignals.OnExitCutscene  += HandleCutsceneEnd;
        }
fierce compass
inland quail
fierce compass
#

so you're receiving messages on PlayerInputV2?

#

and _playerInput is the built-in Player Input component, right?

#

well, the disablings you sent above seem correct. have you tried debugging them to make sure they're being called, at least?

#

i'd remove the null checks so you get an error message if it's the issue

inland quail
#

But for some reason I am still able to control my player duringa cutscene .

fierce compass
#

odd, ive used PlayerInput with SendMessages and ive used .enabled = false;, and that worked fine

inland quail
fierce compass
#

make sure you're targetting the right object

#

try adding a context this to your logs and see what object it points to

inland quail
#

Sure lei do that

austere grotto
#

we need more context

inland quail
austere grotto
#

Also it looks like you have this Middleman component called PlayerInputV2

#

with stuff like:

        public Vector2 MoveInput { get; private set; }
        public Vector2 LookInput { get; private set; }
        public Vector2 DPadInput { get; private set; }
        public float AimInput { get; private set; }
        public float AttackValue { get; private set; }```
inland quail
austere grotto
#

Disabling your PlayerInput component is not going to magically make those values all become 0 or whatever

austere grotto
inland quail
austere grotto
inland quail
#

The PlayerInputV2 manages ALL input for the project

fierce compass
#

ah whoops i'll continue in the thread

stable oriole
#

Is the generated c# class from the action asset only for Quality of Life?

I'm asking this because I'm planning to stop using this generated class. So I don't need to use this stupid Singleton to house this generated c# class and use it throught my project. Also, while working with the InputSystemUIInputModule component in EventSystem, it seems to introduce too many unintutive practises.

I'm planning to completely shift to using only the Actionasset. I think the only downside is -- using Find() to get actionmaps, actions and that being verbose. Are there any other downsides?

fierce compass
#

Is the generated c# class from the action asset only for Quality of Life?
i mean, you could argue that the entire inputsystem is QoL
there are several ways to use the input system, and using the generated class is just one of them, it's not specifically more QoL than the others

fierce compass
stable oriole
#

I'm fine with magic strings. I can implement custom validators for that. The generated c# class~~ is a mess~~ is too much maintenance

fierce compass
#

there are several other methods that don't require magic strings

#

InputActionReferences, for example

stable oriole
fierce compass
#

no, this doesn't use the asset

#

this wouldn't use Find

stable oriole
#

oh

stable oriole
fierce compass
acoustic gull
#

Hello, Can someone help me On my right button it is detected twice, on press and on release, can someone tell me how to do to just have one ( its cuz it spawn twice my vfx on ground to show where i'll go with navmesh)

#

i tried that but it still doesnt work

austere grotto
#

Also the "Press Only" interaction is definitely not necessary

acoustic gull
#

So when i clic right button it send "clic movement" to my FSM and my fsm get the position on the ground and spawn fx on this position

austere grotto
#

the Clic event passes a CallbackContext parameter which has the data you need to determine if it's the click or the release

#

but you're not passing that through to playmaker

#

you're just raising your event no matter what

#

and ignoring the parameter

austere grotto
acoustic gull
#

Oh ok, i just need to tell to PM if its release or press and thats all, i'll try to search it with your link, thank you !

acoustic gull
inner anchor
#

Can someone please explain to me if IPointerHandlers are good? I'm currently using an InputReaderSO but I dont know if I should raycast or use them!
In my game there is a cursor (even with controllers) and you can select non ui objects in the scene. I cant wrap my head around

austere grotto
#

and what is an "InputReaderSO"?

#

So are you asking if they're "good" or are you asking for help getting it to work?

inner anchor
#

Input reader scriptable object

Like (sorry Im on phone)

InputReader : ScriptableObject, IPlayerActions
{
public Action OnMove;

public void Move(Input..) => OnMove?.Invoke()

}
#

And I pass it down on classes that need input like an SO

austere grotto
inner anchor
austere grotto
#

I don't think your input handling is relevant at all to whether you should use event system event handlers

#

For the record yes, you should almost definitely use the event system event handlers instead of manual raycasting

#

It operates seamlessly with your UI and gives you behavior like the UI blocking game world interactions for free

inner anchor
#

Thank you!

tawny island
#

Is there a way to stop Unity showing this message everytime it starts up?

I can't uninstall the package itself because one of the GoogleXR packages we're using keeps it as a dependency, but I was hoping we could at least suppress the prompt

#

I have ActiveInputHandling set to Old in Player settings

austere grotto
tawny island
#

ok ty, I was just worried it'd cause oddities, if not, then, meh

fierce compass
violet maple
#

editor > shortcuts

lethal dagger
fierce compass
#

there's some stuff pinned if you'd like to learn more

tawny island
vale rune
#

im in bad need of help with the input system dude. i just cant get the mouse to work

austere grotto
grave hull
#

hey do you know if there is a discord channel or server where i can get some help and guidance? as a newbie?

tawny island
#

@vale rune You need to say what you've tried, and what specifically is not doing what it should. Otherwise it could just be that your mouse isn't plugged in.

grim swan
#

I'm using the old input system (I think) and am trying to set up more than one controller (so I can have 3+ players) but the controllers are only taking joystick input when the joynum is set to "Get motion from all joysticks" which obviously wont work when theres more than 1 controller

#

how does unity determine which controller is Joystick 1/Joystick 2 etc etc

#

for the buttons it seems to maybe work? theres at least response there instead of there just being nothing

daring current
#

My game worked perfectly last night. I saved, closed the project, opened project today, raycasts not working. Cannot find a reason in the code or anything. What's going on?

austere grotto
daring current
#

Phys was off for some reason. Raycast was the issue.

supple crow
#

Oh, huh, that'll do it

#

No physics atall

glossy cargo
#

I having a build only issue on the newest version of 6000.3.f1, and one of the older 6000.1 versions. Whenever a new controller (xbox series x) connects, the game recognizes the controller (according to the logs) but the event system will not respond to any input. Upon a game restart, the controller will work properly. Any ideas?

austere grotto
glossy cargo
tawny birch
#

I am very much struggling to find a good tutorial for InputSystem. There seems to be many ways to go about using it, and pros/cons per method. There doesn't seem to be a good place to see each method for what it is and how it compares to the others.

fierce compass
#

yeah, with flexibility comes complexity, unfortunately

#

i think good tutorials would just be choosing one way to use the input system and going with that

#

if you want to compare the various methods you'd probably need a deeper understanding than what a tutorial might give

tawny birch
#

Maybe tutorial was the wrong word

#

I more meant a deep dive comparison in each method

#

I seem to pick up a lot of distaste towards the SendMessages method since it apparently isn't performant

#

Invoking C# events seems a little bit overly verbose for such simple things, and not being a huge fan of redudant verbosity myself, I think that Invoke Unity Events might be a happy medium

fierce compass
#

messages are inherently less performant due to the reflection, sure, but is it really on a scale that's significant

#

it's definitely something to consider but i don't think it's an outright problem

#

though, there is a real downside in it being by name rather than by reference

tawny birch
#

I see

#

Unity Events and C# Events seem to be quite similar

fierce compass
#

i can't comment on that, i haven't seen what c# events are 😔

tawny birch
#

It seems to just be you handle everything yourself in scripting rather than a playerinput body doing anything for you

fierce compass
#

that's still through PlayerInput, it'd still be the thing invoking the events, no?

tawny birch
#

I haven't seen anyone do it that way

fierce compass
#

there are other methods that don't involve a PlayerInput at all

tawny birch
#

I needed the extra information you get from a CallbackContext, but I don't really want to handle enabling listeners myself, so Unity Events seems like a semi-performant method for me.

tawny birch
#

Something I am super confused about is look sensitivity. If I don't multiple by Time.deltatime, it seems to work perfectly and not scale with framerate on a mouse. However, on a gamepad, it DOES scale with framerate somehow. It's really odd. I don't know if i should or shouldnt be multiplying by it, if i multiply by it then mouse sensitivity scales with framerate. I'm highly confused at the play here

austere grotto
#

Joystick needs to be multiplied by deltaTime

tawny birch
austere grotto
tawny birch
#

I thought the whole point of input system was unify it

#

Also is the fact that direction on left stic is inverse to what it should be normal

tawny birch
austere grotto
#

It's necessary

tawny birch
austere grotto
#

Could be

tawny birch
austere grotto
#

120 degrees per second is pretty reasonable yes

#

That's not crazy fast

tawny birch
#

I see

#

Oh well

#

Not the cleanest solution but I guess it works

austere coyote
#

Hey so no matter what I try my sprint won't work. I only want it to print out a true and false rn so I can tell why it won't revert back to false after releasing the button. My current code looks roughly like this and it is set to press and release

private bool sprintInput;

void OnSprint(InputValue value)
    {
        sprintInput = value.isPressed;
    }

void Update()
    {
        Debug.Log("Sprint is" + sprintInput)
    }
#

It prints true then never reverts to false

fierce compass
#

could you try adding a log to OnSprint, see if you're getting the event when releasing to begin with

austere coyote
#

Uhhh... somehow it's suddenly working perfectly fine. Idek what I did wrong

#

Or right to be completely honest

fierce compass
#

mightve just needed a reload or something to trigger saving

cobalt mossBOT
#

success @brickwall0004 muted

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

thorn crag
#

Hi, so whenever I make a prefab of my player, it loses all the references to the input action references
Why is this?

fierce compass
#

could you be more specific about what you mean by "make a prefab of the player"

thorn crag
#

Dragging the player empty and it's children into the project screen area

fierce compass
#

(it's not an empty, it's a gameobject)

thorn crag
#

Yes sorry, the gameobject

fierce compass
#

it was just assigned to input action references from an input action asset in projects, right?

#

(not sure how it could be otherwise, just making sure)

thorn crag
#

Yes, the player object in the scene, was given references from this

fierce compass
#

is it already a prefab instance where this would be creating a prefab variant?

thorn crag
#

No

fierce compass
#

not sure if this matters, but try saving the scene if it isn't already

thorn crag
#

This is when it's in the scene, not as a prefab

#

After being dragged into the project area and made to a prefab

fierce compass
#

are the fields being changed in OnValidate or Reset?

#

or in anything else that might be running in the editor

thorn crag
#

I'm not sure what would be running in the editor other than the standard stuff that comes with unity

#

I at least haven't changed anything

livid valve
#

after android build the touch system doesnot work

#

there is no respose to touch , i think touch is not being recorded in android

#

but when using unity remote it works

timber robin
#

Please don't ping usergroups for help, unless it's server related. Thanks.

fierce compass
livid valve
#

no

#

i set it to old

#

there is just click and buttons in game

#

touch only

fierce compass
#

im not sure this channel is for the old input system

livid valve
#

can u help still tho

fierce compass
#

is it just on android that you're having these issues, or do they happen in the editor too

livid valve
#

i am stuck from hours

livid valve
#

it works with remote on android too

fierce compass
#

make sure you have an eventsystem i guess? in case your scene loading workflow in the editor is different from a build

livid valve
#

i searched web and found many faced same issue but no solution

zinc stump
fierce compass
# livid valve

why do you have the new input system ui component on there if you're using the old input system? not sure that'd work, i don't really know how the eventsystem (or the inputsystem adapter) work internally

livid valve
#

the event system came automatically with the canvas

fierce compass
#

right, that's normal

#

that's not what i'm referring to

livid valve
#

maybe i should change to input system "both" ??

fierce compass
#

no, android doesn't support it

#

you'd need the "Standalone Input Module" component afaict

livid valve
fierce compass
#

replacing the "input system ui input module" component on the same gameobject as the event system

livid valve
#

i have no input sustem component

#

i am using from code only

fierce compass
#

you have one right there

#

also consider removing the input system package if you aren't using it (though, eventually you should learn to use it)

livid valve
#

yeah but in this project there was no use for other input rather than touch so claude suggested to use old system

fierce compass
#

sooo have you replaced that component

livid valve
#

replace with what

#

when removed this componene , the buttons don't work

thorn crag
#

@fierce compass So what's even weirder is when open the player prefab, and place the input references. Then press the arrow back to get back to my scene, then click on the prefab in the project window, they're gone

fierce compass
fierce compass
livid valve
#

didn;t worked

thorn crag
#

I've now given it all the inputs

#

And when I go back it seems to stay?

fierce compass
#

oh huh, i thought input action references used GUIDs, nvm on that point then

livid valve
#

i am so frustated

#

gonna break my pc now

thorn crag
#

But I'm not able to give the network manager the prefab now

fierce compass
#

make sure to switch back to the normal inspector

thorn crag
#

Right, but why does it remember the referneces now?

#

Omg it works... but I have no idea why

#

Maybe I just had to restart the editor?

fierce compass
thorn crag
#

Lmao

lyric mountain
#

old input system will always be best for prototyping for me

fierce compass
lyric mountain
#

Can you still listen to any input and polling it with the 'new' system? Thought it was only mouse input at most

fierce compass
#

yes

lyric mountain
#

Ok yeah I see it. Well, guess I've just been lazy

quasi dove
#

Pre Unity 2022.3.43f1 I was able to have a Input Action Reference, which I could call.

public InputActionReference aimAction;
aimAction.action.Disable();

And then make the link in editor to the Input Action Asset, and it would disable the aim.

Now on Unity 2022.3.62f3 this doesn't work. Not only that, if I disable all Input Actions, UI Navigation still works. Why?

I didn't even go up a Unity Version, I moved up for the security reason.

fierce compass
#

(to be pedantic, you did go up several patch versions)

quasi dove
#

I went up in patches, and, the functions I'm referencing were not marked as obsolete.

austere grotto
quasi dove
austere grotto
#

Same asset but maybe not the same instance

quasi dove
#

Again... This wasn't a problem previously...

fierce compass
#

(there is a playerinput in play here as well, fyi - had a convo previously, end)

austere grotto
#

PlayerInput often muddies the water

#

PlayerInput likes to make its own copy of the asset sometimes

fierce compass
#

wait, sometimes?

quasi dove
#

Both are just directly referencing the generated PlayerINputControls

austere grotto
#

Wait those components are both on the same object?

quasi dove
#

Yes.

austere grotto
#

That's pretty weird

quasi dove
#

Both are also pointing to the same object.

austere grotto
#

PlayerInput does weird stuff - and can be affected by the existence or nonexistence of other PlayerInputs in the scene

#

as well as whether they're instantiated at runtime or not

quasi dove
#

Theres one single PlayerInput, always. No additional ones are created.

austere grotto
#

especially by PlayerInputManager (if being used)

#

Do some debugging

#

check if myPlayerInput.actions is the same instance as myUIInputModule.actionsAsset

quasi dove
#

I mean, sure.

However that doesn't explain why I can no longer call

public InputActionReference aimAction;
aimAction.action.Disable();
austere grotto
#

Sounds like you can call it just fine

#

it's just not having the effect you expect

quasi dove
#

It doesn't disable it.

austere grotto
#

that would be explained by the PlayerINput component operating on its own cloned instance of the asset

quasi dove
#

It used to disable said action. It no longer disables said action.

austere grotto
#

the InputActionReference would be pointing to the "original" in the asset, and the PI would be using the clone, unaware of anything you did with the IAR

#

Again start debugging it - you can even print whether the individual actions in question are enabled or disabled

#

I understand it worked before

#

Something changed, possibly in a subtle way. So now we have to find out what

quasi dove
#

So then why the hell is PlayerInput creating a clone of the objec then? Whats the point of even pointing it towards something?

fierce compass
#

oh, the step that clones the asset is conditional.

        for (int i = 0; i < s_AllActivePlayersCount; i++)
        {
            if (s_AllActivePlayers[i].m_Actions == m_Actions && s_AllActivePlayers[i] != this)
            {
                CopyActionAssetAndApplyBindingOverrides();
                break;
            }
        }
austere grotto
#

largely due to this kind of mysticism

quasi dove
#

So your recommendation would be to move away from it?

#

Sidenote: It does show as "Cloned" in editor on Runtime.

I still dont know why its cloning it when I have 1 player only.

austere grotto
#

yep that's a sure sign it's a cloned instance

austere grotto
#

Then you're in full control of it and can do whatever you want and not run into weird ephemeral issues like this

#

you can also keep using playerinput but just do myPlayerInput.actions = myManagedInstance;

#

either way - managing your own instance is key

quasi dove
austere grotto
#

to be clear it's not someting I've tried. Just something I noticed should be possible based on the api

#

Typically I just avoid PlayerInput entirely.

quasi dove
#

If I can set it via runtime, everything would be fixed. Based on manually doing it, everything that previously worked, works again.

fierce compass
#

it seems like that might also create a clone

quasi dove
#

But, I guess I'm going to have to write my own PlayerInput, which, is not something I'd like to do but I guess will have to happen at this rate.

fierce compass
#

you could just use any of the many other ways to receive input from the input system without replicating the interface PlayerInput provides

quasi dove
#

Its more so the project has been ongoing for long enough that, if I were to move over to any other ways to receive input, it would require a fairly large re-write of everything else.

fierce compass
#

yeah, fair enough

quasi dove
#

Its less about having the UI/interface, I still need to handle what it was handling for me, in my own script.

austere grotto
#

A short term band-aid here is just make sure you disable the action in both places everywhere you do it.

fierce compass
austere grotto
#

you could make a helper function that passes in both asset references and applies it to both

quasi dove
# austere grotto A short term band-aid here is just make sure you disable the action in both plac...

I assume you mean in both the Cloned instance and non-cloned instance?

At that point I think it'll just be as easy as re-writing the PlayerInput sadly. The main thing I was using it for at the end of the day is: Passing Player Input to another scriptable object. (Long story on that one. Not going to get into it but easy enough to handle...) and automatic control swapping. (Between KB+M and Controller.)

austere grotto
quasi dove
austere grotto
quasi dove
austere grotto
short widget
#

man i dont even know
why cant i assign my input system c# script

#

nevermind

austere grotto
queen meadow
#

so i have a question. I have several unity projects. One of them as of 3 days ago was working fine. I even made a game build and worked fine no issues and had not make any changes to the project or build. Today I am working on another project and the input system is acting strange like I have to keep tapping w to get it to sort of move forward and such and it barely moves with tapping and does not move at all holding it down. Now when I go to my other project same issue and including the build that both of those i never touched since it last worked. The version from my other project is using unity 6.2 and this newer project is using unity 6.3. both using the new input system

#

and i wanted to make sure it was not something with my pc or keyboard so i fired up a game i know for a fact was made in unity that i had purchased on steam and that works fine

fierce compass
#

perhaps check the input debugger to see if it's receiving input correctly

queen meadow
#

yea the debugger shows it fine

#

and holding down the key it is spamming like i would expect so technically this should be working fine

#

ok i think i found the issue but not sure how to block it from messing with it. I have a PXN CB1 button box for when i play a truck game but i am not using it for my unity projects so for some reason unity is trying to read from that even tho nothing is being pressed from it

#

i noticed the debugger showed the box on the list which gave me the light buld of that could be the issue and i unplugged the thing and it worked

#

because eventually there will be game options to allow for this control or that control how do i prevent a controller like that not mess up another. I am confused of why that conflicted when my xbox controller does not conflict and it works as well as the keyboard and they do not fight each other like that

uncut swift
#

I'm making a dialogue system and was thinking about how I want to handle options in dialogue.
my idea was to have a Choice action where each binding would pass in an int value.
so binding 1 passes along 0, binding 2 passes along 1, etc.

not sure if it's possible nor am I sure how to do it. anyone know?
if it's not possible I could make 9 actions and subscribe to all of them but I feel like that's a waste

lyric mountain
#

It's been a minute, but when you generate a c# class from an input asset I notice that you don't need to do a Find anymore when binding maps, but it still seems like I need to do Find for each individual action, is that correct?

#

Unless my IDE is being funky because I would assume these actions would become accessible

lyric mountain
#

Ah, ok I see what I'm doing. I was thinking that the InputActionMap would been modified to provide these accessors, but there's a specific struct instead that's generated.

austere grotto
#

the 1 minute it will take you to actually create them is worth it.

supple crow
#

a dialogue system probably isn't displaying dozens of prompts per frame

#

so you can do basically whatever you want with no performance impact

austere grotto
#

Calculate the 99832958337252975th digit of pi each time

supple crow
#

4.5, plus or minus 4.5

#

done

austere grotto
#

just so the computer is having some fun

grand kiln
#

What is the new keyboard input system for unity 6.2?

fierce compass
supple crow
tawny island
#

hey guys, is the old input system due for deprecation?

#

I have this message in latest Unity

#

is it talking about the old GetAxis(), GetButton(), etc?

fierce compass
tawny island
#

ah damn, that's gonna be a pain to replace in my prj xD

#

ty for confirming tho

fierce compass
#

it's probably not going to be removed for a long while, and i haven't heard news about it actually being planned for deprecation

fierce compass
#

(but you should still learn the new input system, it's pretty good)

tawny island
#

ah yeah, ive been making a point for my time-waste hobby project to always update it and work through any pains that come as a result

#

normally i do as you said, just not for this particular prj

#

deprecating it will force me to finally look at the new input system lol

#

actually it might not be so bad. All my inputs are custom handlers that only ever used unity's input from a single class, so i probably only have to update in that one place

austere grotto
true tundra
#

How do I detect when the player moves his mouse while holding right click?

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

//--Writing space--//
public class CameraRotation : MonoBehaviour
{
    //--Public Variables--//
    public GameObject Player;
    public InputActionAsset PlayerInput;
    [Space]
    public float ZoomMax = 10;


    //--Private Variables--//

    private float ZoomMin = 0;

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

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

   //I want to detect the inputs when they are pressed 
}```
I dont know how to detect inputs
#

Do I also add a right button + dragging combination sort of thing?

true tundra
#

How do you check if the button is pressed in Unity, if your project uses New Input System?

That's very simple! First of all, the New Input System doesn't have the same if statement to detect if a button is pressed, as it was the case with the old input system. Instead, you should add an input actions asset and make a set of actions that can be ...

▶ Play video
#

And I got this error ```Cannot declare a variable of static type "InputSystem"

#

And I dont know what it means

#

I watched that tutorial 5 times

#

I am not able to comprehend why that error keeps happening and how would the script work without a reference to my InputThingy

true tundra
#

Nevermind I figured it out

#

I WIN

dawn hill
#

I'm really trying hard to like the new input system but its very hard to adjust to it. I've created a separate Dash action with Multi-Tap interactions and linked it to a dash method without movement script. Added a basic Debug.Log("Dash input received");, but for some reason it gets triggered twice every time. Any ideas anyone, what am I doing wrong here?

fierce compass
#

check the phase too

austere grotto
dawn hill
#

Just got back, I've had a skim on the docs nothing said about the phase. Any recommendations on how thats done?

dawn hill
#

Right I see what happened here. When you said check the phase I was slightly confused but I was doing that all along with everything else aka context.perfomed in an if statement. I only call it once now. Honestly didnt think that would be such a huge thing about phases but here we are.

#

Thanks

pale verge
#

im using this configuration for an orbital camera which only moves if i click and drag the screen, but i want the camera to permanently move with the mouse, i was told to rebind to mouse delta but that doesent seem to work or register

#

on top of that unity doesent seem to recieve my mouse inputs

lucid locust
#

Whats with the input manager error, how do i get rid of it. Using 6.3

shrewd crown
lucid locust
lucid locust
shrewd crown
#

But I'm not home so I can't help find it

lucid locust
fierce compass
#

it's not an error

lucid locust
fierce compass
#

then don't, and use input system instead, and configure your project to use input system

#

!input

cobalt mossBOT
# fierce compass !input
How to Set Input

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

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

fierce compass
#

input manager is fine to use btw - it's the old system, it still works
input system is the newer system, it's more flexible but also somewhat more complex

#

i'd recommend the new input system, but more of a "learn this eventually"

lucid locust
#

ok

shrewd crown
#

I like the old one better tbh

#

I don't mess with the new one 🤣 and it'll probably stay that way until it makes more sense to change over

river light
#

what the equivalent of Input.GetKeyDown(Keycode) and Input.GetKey(Keycode) in the new input system?

#

suppose i want getkeydown for attack input

fierce compass
#

for events, you'd generally keep a state, and modify it according to performed and canceled events, or from those fields in a CallbackContext, or from isPressed in an InputValue

river light
fierce compass
#

you can

#

why did you reply to that random message lmao

river light
#

i thought i was replying to you. didnt check.

fierce compass
#

with inputsystem, you gotta say what you're coming with
there's a lot of ways to do any given thing, to list them all would be a ton of work lol

river light
#

opening unity and chrome together crashes both of them. spotify and discord work fine though

fierce compass
#

well, that's terrifying

limpid pollen
fierce compass
#

are you on linux

river light
#

no i am on windows

fierce compass
#

has it always done that?

river light
#

is 16 gb ram enough to use chrome and hdrp projects+visual studio at same time

fierce compass
#

yes

#

well, hdrp... not sure about that part actually

river light
fierce compass
#

has it been consistent with this project?

#

and does it happen with other browsers? you're definitely going to have to research stuff online eventually

river light
#

yes almost either unity crashes or the web page gives a error

fierce compass
#

with the error being about memory?

limpid pollen
#

Try chrome without hardware acceleration? (Probably VRAM issues)

fierce compass
#

ahh this is way off topic of the channel lol, you should probably ask about this in #💻┃unity-talk

river light
#

i assumed its because of ram filling up cause both chrome and unity use lot of ram

tawdry roost
#

I know this isn’t insanely relevant, but I find it really funny that there is a whole channel just for the input system

fierce compass
#

well, it is quite extensive

frosty raft
#

Can input system be set to receive keyboard and mouse inputs when the application is minimized?

#

I think "ignore focus" with run in background would to do it, but doesn't seem to with mkb

#

Confirmed it works with gamepads, the application can get their input even when fully in the background

raven iris
#

how do i fix this error?

austere grotto
raven iris
austere grotto
# raven iris

It seems self explanatory, no?

Either do what it says or switch to an asset that isn't the project wide asset

#

Or remove this asset as the project wide one

raven iris
#

oky

raven iris
#

so i decied to learn from the youtube video https://www.youtube.com/watch?v=Cd2Erk_bsRY&t=40s where do i find the animator thing?

This is the second video in the Input System series, where we dive into scripting with the Input System to control a third-person character.

You'll learn how to write code to move and jump the third-person character using an Input System Asset, with support for both gamepad and mouse-and-keyboard inputs.

We’ll also add a simple pause menu to...

▶ Play video
austere grotto
raven iris
fierce compass
#

menu bar > window > animator

#

might be in a nested menu

latent tangle
raven iris
#

Thanks I’ll take care

gritty pasture
#

Hello everyone! I don't know where to include this but I'm trying to make a simple game in Unity, but for mobile. I have used the new Input System and through the PC, I bind the joystick and some buttons from a VR controller that are dedicated for mobile. It works fine on PC, but when building the APK, the controller doesn't want to work.

#

This is how I get the input. private void Awake()

    controls = new PlayerControls();

    controls.Gameplay.Move.performed += ctx => moveInput = ctx.ReadValue<Vector2>();
    controls.Gameplay.Move.canceled += _ => moveInput = Vector2.zero;


    controls.Gameplay.Select.performed += ctx =>
    {
        debugText.text = "Trigger Pressed!";
        Debug.Log("Trigger Pressed!");
    };

    controls.Gameplay.Select.canceled += ctx =>
    {
        debugText.text = "Trigger Released!";
        Debug.Log("Trigger Released!");
    };
}```
gritty pasture
#

Nvm. I used the old input system and worked fine. The new input system is bugged for what I want to do.

vale zodiac
#

public void OnShoot(InputAction.CallbackContext val)
{
if (val.performed)
{
Debug.Log("idk");
}
}

The could should print idk when i hold the shoot and stops when i stop holding

austere grotto
vagrant gale
#

Why does the input actions settings tab do this?
when clicking on the Path field for the first time, I'm suddenly instantly redirected to the first item of the first tab (Player/Move)

verbal remnant
light sphinx
#

Hey I could use some help, in my game I have splitscreen with the input system but when I have 2 players the UI doesn't shrink down to show everything so the score at top right corner and the ability icons in the left corner can't be seen. How could I make it work?

light sphinx
#

ahh okay thank you

fresh mortar
#

Genuinely how do you remove a binding from the new input manager?

fierce compass
verbal remnant
#

delete == press the delete button on your keyboard

pine elm
#

Hello everyone. I'm learning how to do AR right now. The tutorial I am following, for setup, says to set "Active Input Handling" to "Both" within Player settings because it avoids error messages from plugins/assets. Can I get peoples opinion on this? I was thinking, not to do it, and wait and see if any errors appear/deal with them at that time. Is there a downside to using both?

austere grotto
versed mantle
#

!Turtorial

cobalt mossBOT
versed mantle
#

!tutorial

cobalt mossBOT
radiant flicker
#

hello, I'm starting a new project. is this InputSystem_Actions file part of the new input system?

#

I heard about the new vs. old input system but I'm not sure which one is which

radiant flicker
#

thanks

#

I'm brand new to DOTS so I'm also a bit confused on how this system integrates with that

#

specifically because DOTS wants to work with unmanaged types

#

is there a place I can learn more about that integration process?

wheat spade
#

Im trying to add my input reference actions from the unity input system onto a scriptable object this used to work a few months ago but now it doesnt work it just says none even tho its showing the inputs and letting me drag them in and my old inputs arent gone but if i try to change their input action it doesnt let me

using UnityEngine;
using UnityEngine.InputSystem;

[System.Serializable]
public struct InputEntry
{
    public string Name;
    public InputActionReference Action;
}

[CreateAssetMenu(menuName = "Scriptable Objects/Input Data")]
public class InputData : ScriptableObject
{
    public InputEntry[] Inputs;

    public InputEntry Get(string Name)
    {
        for (int i = 0; i < Inputs.Length; i++)
            if (Inputs[i].Name == Name)
                return Inputs[i];

        Debug.LogWarning($"[InputData] No entry for '{Name}'");
        return default;
    }
}
weak sequoia
#

my simulated touch not working in the device simulator. ( specifically its not registering hold and drag ). I have enabled simulated touch in input debugger. i am using the new input system (1 press[touchscreen] 1 position[touchscreen])

pallid karma
#

Is there a way to check what the most recently used input device was?
Trying to change some UI to match the icons on the most recently used device, but I can't seem to find an option to do that, outside of making an instance of PlayerInput just for that.
Is there a more elegant solution I am missing?

verbal remnant
pallid karma
verbal remnant
pallid karma
#

Will do!

verbal remnant
#

most coherent game design ever.

pallid karma
#

And thank you for taking your time to help me

#

I still gotta play the previous two lol

verbal remnant
#

😄

#

also tell them: "needs subtitles"

pallid karma
#

Howdy, what troubles you?

civic anchor
#

hi. can someone help me with input for an rts? i want to move around with wasd, but also type into input fields. is there a sane way to handle that? not sure why the ui doesn't just automatically eat inputs and block trickling them down.

#
        public void OnNavigate(InputValue value)
        {
            if (_eventSystem.currentSelectedGameObject == null)
            {
                _cameraMoveDirection = value.Get<Vector2>();
            }
        }

maybe like this?

regal jackal
#

Why does when I try to edit inputsystems actions, unity just keeps trying to compile it (and failing, I think? Since it's been trying to do it for quite a long time)?

shadow tartan
#

Uh guys

#

So apparently i was using getaxisraw for 3d movement in previous version

#

And now in unity 6 i found out it didnt work anymore

#

I did switch input to both but the problem wasnt solved

#

So how do i use the new input system

fierce compass
#

if you do want to switch over to the new system, there should be plenty of tutorials

shadow tartan
#

Okay tks

tame rivet
#

hello, can anyone explain to me why my code isn't working as intended?

xRotation -= mouseY * mouseSensitivity;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
cam.transform.localRotation = quaternion.Euler(xRotation, 0f, 0f);```
the problem I have is that I can make about 20 full 360 rotations on the x rotation before the clamping sets in, I've looked at what went on with the variable values and found that when the actual rotation is at 90/-90 the xRotation variable is only at 1/-1
fierce compass
#

what's quaternion there?

#

that's not a UnityEngine thing

#

are you perhaps using one from Unity.Mathematics

tame rivet
#

that line is something I got from a tutorial from brackeys

fierce compass
#

casing matters

#

and that does seem to indeed be the issue

tame rivet
#

from what I understood it should give the rotation, found some more about it also on docs.unity, but nothing adresses this specific problem

fierce compass
#

quaternion.Euler is in radians
Quaternion.Euler is in degrees

#

you did not accurately follow the tutorial

tame rivet
#

ah

#

thanks, never thought that that would be the problem

fierce compass
tame rivet
#

yes it does

#

it works as intended now, thank you

ebon valley
#

hi, i have to use my side mouse buttons on old input system, can anyone help

latent tangle
#

you can do if(GetKeyDown(Keycode.Mouse(your selected number))) to check for it being clciked

ebon valley
#

not working i already tried

#

just 1 2 3 is working

#

these are my ghub settings

austere grotto
#

That button toggles between three different computer/bluetooth connections for the mouse

#

It doesn't actually send any input to the computer

ebon valley
austere grotto
fierce compass
ebon valley
fierce compass
#

this isn't specific to the input system, it's just how mouse input is treated afaik. i'm just mentioning that inputsystem explicitly calls that out

ebon valley
fierce compass
#

i'm not sure

#

i don't have the special mouse app thing, and getting buttons 4/5 (index 3/4) work fine for me

#

so maybe it's your mouse settings, making them send different events?

ebon valley
fierce compass
#

in your case specifically, my best guess is that your mouse settings mean your side buttons are acting as macros, not actual side buttons. you could probably confirm or deny that by checking browser events maybe?

ebon valley
broken cipher
fierce compass
#

maybe try checking with the input system debugger to see if events are firing?

fierce compass
# broken cipher

control schemes are kinda exclusive with each other, if you want to use the mouse and keyboard together then they'd have to be in the same control scheme
though, you could also just not deal with control schemes in general

broken cipher
#

theyre currently on the same control scheme but the mouse just doesnt work

fierce compass
#

have you tried the input debugger to make sure your input is going through to the input system?

broken cipher
#

idk how...

fierce compass
#

there's a button at the bottom of your player input that says input debugger

broken cipher
#

ye but how do i see if things are being read, i opened it and played the game but it didnt do anything, however, the keyboard input that do work didnt make any visual change either. i did see that my mouse was under unsupported devices but so was my keyboard and that works fine

fierce compass
#

debuggers don't fix things

#

they give more info so you can fix them

broken cipher
#

K, thx

#

I'll try that later

broken cipher
#

it is registering the event, when i click the event id goes up

latent tide
#

How hard is switching from the old input system to the new one?

fierce compass
#

depends on how familiar you are with the new one, and depends on how much you're using input

latent tide
fierce compass
#

for some things in the old input system, you could just do a find & replace and it'd be pretty easy (though, that's not really the intended usage of the input system)

austere grotto
#

Obviously if you have no idea how the new system works it won't be easy

fierce compass
#

i mean, that's kinda.. everything

austere grotto
#

Like "how hard is it to make a clay bowl". Well it depends on how good you are at pottery

latent tide
austere grotto
#

i don't know how many lines of code that is in your project

fierce compass
#

which might be a lot or a little, depending on your target. there's a lot of ways to use the input system

latent tide
austere grotto
#

then you will have to rewrite about 40 lines of code

latent tide
#

I just have movement and rotation so far

austere grotto
#

not the movement code. Just the input reading code

fierce compass
#

input system usage options:

  • InputActionReference as a serialized field, poll that
  • InputActionReference as a serialized field, subscribe to that
  • PlayerInput component with messages
  • PlayerInput component with UnityEvents
  • PlayerInput component with C# Events (not sure what that entails)
  • Generated class, poll that
  • Generated class, subscribe to that
  • Get hardware InputControl, poll that
#

i don't necessarily recommend any specific one, and i haven't included options that involve magic strings

cursive tulip
#

I'm trying to place my Actions Keybind for my InputAction Map and I have really problems with my Steam Deck. Its super weird, touch screen != Touchscreen and the Gamepad South button is Spacebar?

I am trying now since 2 days to make my submit button and touchscreen work and the submit button was working if I say its a Keyboard Spacebar. but Touch still doesn't work, I heard that it is managed like a mouse input but saying its a mouse still doesn't make it work. I can use a mouse with the right Dragpad and click my Unity UI buttons with that but I want to click it with either Submit and by pressing your finger on the button on the Steam Deck Touchscreen.

fierce compass
#

would it be possible to hook up your steam deck to the input system debugger somehow? that could probably help get a better picture

cursive tulip
#

I make a change, compile for Linux and upload it to Steam and turn it live the receive the Update on my Deck.

fierce compass
#

it also seems that inputsystem doesn't specifically support the steam deck, so maybe there's just some disconnect there

cursive tulip
#

I use Unity 6000.3.4 by the way.

fierce compass
#

i don't think that should matter too much - the input system package version might though

cursive tulip
#

but the multi touch support for linux I guess? even if I dont need 2 fingers at once but it was part of those reddit posts so I guess its worth to mention.

fierce compass
#

also perhaps check if there are any packages for steam deck support

cursive tulip
# fierce compass also perhaps check if there are any packages for steam deck support

I guess Steam Deck is just Linux PC as build if you dont want to need Proton and I just saw the last post from your reddit link and I I took a look in my own Steamworks page instead of Unity. I was not even thinging about that also can play a impact. now I have set it to this. (Do I need "Generic (Direct Input)? My game will be for PC, Steam Deck and (maybe for Android) so I keep in mind that I am trying to maybe make the Steam Deck use the same kind of Touch screen logic like Android? thats why I selected "Direkter Zugriff auf die Touch-API"

fierce compass
#

i'm not familiar with this at all, i have absolutely no clue what any of that is lmao

#

i guess tryitandsee

cursive tulip
#

right now my game is on steam but not realesed and I am uploading my unity made build with a SteamSDK Tool to Steamworks and press make it live. Just with your reddit link I also noticed that Steamworks also have some settings that can have a impact of how the InputSystem will behave to the hardware of the Steam User.

trim agate
#

what is the best way to fix my character not moving when I am holding both left and right with a keyboard? using a vector2 for movement

austere grotto
trim agate
#

for example if I am holding D (right) and then start holding A (left) it would go left, and vice versa

austere grotto
#

You would need to break it up into separate actions for each direction, and then you would write the logic yourself for the deconfliction

#

There is no support for "last key wins" for axes and composites by default

cursive tulip
ebon valley
fierce compass
#

you could also try a mouse testing site to see if the buttons are picked up as mouse buttons (as opposed to being keyboard macros or something)

broken cipher
fierce compass
#

no, there might be some difference in how you'd handle button types vs value types in general but that doesn't sound like the difference you have

#

have you tried an unconditional log in the receiver, above/outside any flow control?

broken cipher
fierce compass
#

sure, that'd work

broken cipher
#

But what do I do if the code is running but not working or it isn't running even though the action think is registering the input

fierce compass
#

you would investigate why and fix the cause

#

just like any other problem-solving

broken cipher
#

Thank you Mr Pekora

inland path
#

I hope that what I'm about to ask makes sense, but I'm trying to build a system that takes in an input action reference. Is there a way to get the returned type from an input action?

#

Im trying to avoid hardcoding my entire input system but I think I might have to, since it doesn't seem like there's a way to get the type unless its at runtime, when the event is triggered

austere grotto
inland path
#

it doesn't really matter anymore, i've moved on from that

#

I have the new issue of performed and cancelled callbacks seemingly not working

#

i've confirmed that the method that subscribes stuff to the delegates is called

#

but the delegates aren't being raised

#

yeah the delegates just straight up aren't doing anything

#

do I have to do anything more with an input action asset than call Enable on it?

austere grotto
inland path
#

it is now fixed, but i literally just did the += thing on the performed and cancelled events

#

and had actions.enable() after

#

I regenerates project files and it works

supple crow
#

regenerating project files just makes sure your code editor is working right

#

If you have Domain Reload upon entering playmode disabled, you could have behaviors that depend on whether or not you just recompiled

final slate
#

I’m currently having an issue with the jump function in my game. When I inputted the system and got the jump key, I had tried to change the controller input on the quest 3 controllers to the left stick button for jump (because that was something used in a reference game) but that didn’t function no matter how I fixed it. Somewhere in the chaos, I accidentally deleted the function state of jump off of my right controller. I am now realizing that I need the jump mechanic on the right controller, so I copied the function off of the left controller and tried to do the input as secondary, aka the top most button of the controller, but nothing seems to work. What should I do to either remake the jump button, re install the jump button, or get some sort of alternative?

final slate
#

Any help would be appreciated in this area 😭

austere grotto
final slate
austere grotto
#

If you could use the terminology of the input system that would help

#

and no, don't DM them to me

#

you can post them in the channel or make a thread

final slate
final slate
#

This is what im looking at. I copied over the jump from right to left and tried using the xr controllers to set up the secondary button but to no avail\

austere grotto
#

also it would help if you actually selected the Jump actions so we can see their configuration

final slate
#

one moment i may have found a solution (idk how i didnt find this before)

final slate
#

Its been solved

#

Thank you for your time

tepid thistle
#

I have a problem with the On-Screen Buttons, they only respond to the arrow keys, but not to the space or the WASD. The regular bindings still work with the keyboard

austere grotto