#🖱️┃input-system

1 messages · Page 26 of 1

tame oracle
#

I'm confused, with the Player Input: I use 2 Schemes UI and my Own. If i preset the Control Scheme to Any both working, but if i set them to mouse & keyboard, only the UI Scheme works and the custom one doesn't. Any Idea what i missed ?

supple crow
#

Is the entire composite also marked as being part of the Keyboard&Mouse control scheme?

silk warren
#

Hey, I'm still having issues with my button not detecting hovering/clicks
My Event System is set up like this:

glass forge
#

Does anyone know of any guides on building a combo input system? Specifically, I'm running into an issue of animator triggers not interrupting exit transitions from the current animations, making combos very sluggish feeling

#

I have a script that increments a currCombo int. At a specific point on each animation clip, there's an event that plays which calls SetTrigger based on the currCombo value

#

However, if you press the combination at speeds less than instantaneously, the transition to the next attack seems to be ignored in lieu of the transition to Exit

#

Even though each Exit transition has an interruption source of the Current State

supple crow
#

Click on one of the states and check the order of the transitions

#

if Ordered Interruption is turned on (which I prefer!), a transition higher in the list can't be interrupted by a transition lower on the list

glass forge
#

I checked, and the transitions from attack to attack supersede the transitions to Exit

#

Yet the actual transitions to Exit won't get interrupted by the next trigger

real raft
#

Can someone please explain to me why the camera isn't rendering?

silk warren
#

Because luigi too fast to be caught

real raft
polar carbon
#

Hey, I'm experimenting with the new input system to understand it better. And I'm trying to test this:

#

I set up my actions like so

#

But when I do Shift + A, both actions trigger

#

What am I missing in this case?

#

I am subscribing to all actions on the Input Actions Asset (easier to test) by iterating over them and adding to (among others) the .performed event

#

But the same behaviour is present with PlayerInput component and Unity Messages

polar carbon
#

Update: Solved
Turns out this behaviour is not enabled by default and the documentation does not mention it

austere grotto
polar carbon
austere grotto
#

which toggle are you referring to?

polar carbon
polar carbon
tame oracle
timber garden
#

Stupid question, that I believe has been asked to death over and over again - how do I properly implement a button where it checks if it's being held down?

fierce compass
#

if you think it's a common question, have you tried googling about it?

anyways, what do you mean by "checks if it's being held down"?
like, do you want do something each frame it's held down or something?

timber garden
#

In the Player Input component, I have set the behavior to Send Messages, and it has worked well for translating Vector2 values into movement and simple buttons where you only need to press once. But for some reason, I just can't properly wrap around my head on how to check whether the button is being held down, or alternatively, where you change the boolean values

fierce compass
#

wait by "button" do you mean like, ui button, or a physical input device button

timber garden
#

Physical input, I think? By pressing/holding down a button, I mean an action created in the Input Actions Editor, where the Action Type is set to Button (rather than Value or Pass Through)

fierce compass
#

ok, i thought you meant a ui button at first lol

timber garden
fierce compass
#

how to check whether the button is being held down
by this do you mean you want to have an action for holding down the button (as opposed to a tap & release), or to just have a function to get whether or not the button is currently held?

fierce compass
#

the former would be an action triggered when the button gets held
the latter would be some method to query in some arbitrary frame, whether the button is held or not

timber garden
#

Is the former being only called once? Whether it recognizes that it's held down or released?

fierce compass
#

yeah

timber garden
#

Then I'll go with that one, I think

fierce compass
#

like, if you press it and release it, it won't trigger
if you press and hold it, it will

#

in that case you can just add an interaction in the action properties pane

timber garden
fierce compass
#

(to be clear; im asking because im not quite sure what it is you want from the description, if you could explain what you're trying to do that could help)

timber garden
#

I want to add a button that will let the player run in the 2D plane by checking the boolean, where if the button is being held down, the boolean would be set to true, and if not - vice versa

#

Previously I managed the holding of the Run button by setting it's action type to Value, and by setting the threshold manually in script, but I thought that was counterproductive since "why do I need to reinvent the wheel when Unity provides me with that option already" - but for some reason it created more problems than solutions

fierce compass
#

ah ok

#

button type actions only trigger when they're pressed, not when they're released, so pretty sure you do just want a value here

timber garden
#

Really? Aww man...

fierce compass
#

but given the kind of, i guess, "intent" of button vs value, i think value would make more sense here

#

buttons are like, triggers to perform some specific action

#

rather than a modifier, which you're going for here

timber garden
#

Ah okay, gotcha

fierce compass
#

doing it with a value would be pretty straightforward

timber garden
#

Anything else I should know about the new input system? I feel like I've been fumbling the bag when it came to implementing it properly

fierce compass
#

uhh not in general, i can't think of any general tips for transitioning

#

that's kind of a broad question

timber garden
#

Okay, how about umm....

#

When do I need to use Interactions/Processors when mapping an action?

fierce compass
#

have you tried adding them to see what they are?

timber garden
#

No, I did not - I'll look into those myself. Thank you for the help.

ornate nymph
#

Does anyone have problems with rebinding actions using the current InputSystem (1.11.2) in Unity 6? I've tried the Rebind UI sample that comes with already written code in order to rebind a specific action but even there, it says it's rebinding but it really isn't. Did anyone else encounter this issue?

austere grotto
ornate nymph
#

I guess i'm doing something wrong. I've got it to work in an older project using Unity 2022 something. Now i just opened a freshly new project with Unity 2022 again and tried the same thing with the sample again. Still doesn't work. Now i at least know i'm the problem😂

austere grotto
ornate nymph
#

Yes i will check that out again tomorow. It's driving me crazy when you know you got it one time and the next time it doesn't work

sudden lagoon
#

hello, I would like to ask or some help. I have webgl application and have some weird touch behavior with input,
I have full screen webgl (black rectangle) then zone 1 which is just webgl and then zone 2, where HTML UI is. When webgl focus is lost, I disable input on webgl, and return when it gets focus again. Everything works as intended as long as there are one finger on the screen 1 or two finger on screen 1. However if another finger touches screen two, glichiness begins. It return me values and keeps alternating between them;
example:
mouseDelta keep alterating between** (-42.00, -867.00) -> (42.00, 867.00)**
When mouseDelta values with one finger looks more like this (-3.00, 0.00).

I wonder if anyone seen this behavior and knows how to fix it or have workaround about it.

public void OnLookRawInput(InputAction.CallbackContext context)
{
    Debug.Log("context:" + context);
    if (isRotating && !isPinching)
    {
        Vector2 mouseDelta = context.ReadValue<Vector2>();
        ProcessLookInput(mouseDelta);
    }
}
tame oracle
fierce compass
dim cape
#

Hi, my Unity UI input doesn't seem to work. I am using the new Input System. When I am using Arrow Keys and/or Enter nothing happens. Any clue why this is happening? I am trying to fix this for over an hour.

austere grotto
#
  1. did you make sure to Enable() the asset?
dim cape
#

However when I noticed that it didn't work

austere grotto
#
  1. are we sure the arrow keys and enter are hooked up to the appropriate actions?
dim cape
austere grotto
dim cape
#

Same thing I am describing in the message. No input in the UI works.

austere grotto
#

What are you expecting the arrow keys and or Enter to be doing that they're not doing?

#

I would definitely switch back to the default

#

the problem likely lies in your scene setup

#

Using a custom asset is adding more uncontrolled variables. We know the default one works under normal circumstances

dim cape
#

Well, I just changed to the default one. In my scene with the Visualize button it shows the arrows correctly

#

So button selection should work with arrow keys

austere grotto
dim cape
austere grotto
#

YOu would need to do EventSystem.current.SetSelectedGameObject(playButton);

austere grotto
# dim cape I do

yeah for whatever reason that First Selected thing has never worked

#

in the last 10 years I've used Unity

#

I don't know what its deal is

dim cape
#

Hmm, interesting. I remember it used to work, however that may have been when I was using the old input system

dim cape
#

I also tried the Select() method directly on the button but it still doesnt work?

#

OOOOkk nevermind

#

I had a thing that messed things up in the update function

#

Thanks a lot for your help!

digital wing
#

Would this be the equivalent of the Axis in old input system?

#

Where you could use GetAxis("Horizontal")

fierce compass
#

axes

supple crow
#

As long as the type of the "Horizontal Movement" action is Value, with a control type of Axis

fierce compass
#

oh whoops misread the question

#

but yes

#

you could make it have multiple axes as well

digital wing
#

I assume you don't just use GetAxis with the new input system

#

Gotta search how to do that

supple crow
#

Right. You get the value of the Horizontal Movement action

#

The new input system gives you a lot of ways to access this. It can be a little overwhelming at first.

digital wing
#

Good thing I already have coffee then

supple crow
#

personally, I like to use a PlayerInput component to handle turning on the actions for me, and then I use InputActionReference fields to refer to specific actions

#

an example:

#
[SerializeField] private InputActionRefrence horizontalMovementRef;

void Update() {
  float input = horizontalMovementRef.action.ReadValue<float>();
}
#

and then you just slam a Player Input component somewhere in your scene (probably on the player object...) so that your actions get turned on

digital wing
#

Is it just a pre-built Input Action?

supple crow
#

It's not an "input action", no

#

It's a component that manages:

  • Turning input action maps on and off
  • Calling methods when input values change
#

You can have it call a method when a button is pressed, for example

digital wing
#

Can't say I'm not confused about the difference

supple crow
#

An input action is just a definition

#

This is an input action called "Zoom"

#

It has two bindings -- the scroll wheel and the d-pad

#

This does absolutely nothing on its own. It's strictly a definition of a kind of action.

#

This is the Player Input component. You give it an input action asset. It handles enabling/disabling groups of input actions. It will also call methods for you when the action values change.

digital wing
#

I still gotta move my Input Action to that component

#

So it knows about it

supple crow
#

You'll assign that asset into the PlayerInput component.

#

The asset stores action maps, and action maps store actions

digital wing
supple crow
#

I have different groups of actions for different situations. I can have any combination of these enabled at once

#

In your case, though, you'll probably just have one map

digital wing
#

I see, thanks

#

Do I have to generate a new C# for every Input Action Asset I create?

austere grotto
digital wing
#

Was I doing it wrong?

austere grotto
#

I was simply commenting on the fact that the generated C# file is never mandatory to use. It is a convenient helper.

digital wing
#

Ah ok

short rose
#

Hey all, im trying to setup input for VR, and i will need 3 sticks in order to handle everything, as most controllers only have 2 analog sticks in total, i plan on having it so that when you hold in the stick, it acts as a modifier key in order to make it do a different action, I've tried setting it up in the input manager, but for some reason the only option i can see for "binding" is the simulated input, is this fine, or am i doing something wrong? I suppose i could always handle it in code instead, but if it's possible to handle in a neater way outside of code that would of course be preferred, thanks

fleet mural
#

Question:
I have an Input System set up here, and I am trying to write code to detect if the player is taping, holding, or releasing the Key. However, the line "Hold" only shows up once, even though I am holding the jump key. Does anyone know how I can fix this?

    {
        playerControls.Player.Enable();
        playerControls.Player.Jump.performed += Jump;
        playerControls.Player.Jump.started += Jump;
        playerControls.Player.Jump.canceled += Jump;
    }
    private void OnDisable()
    {
        playerControls.Player.Disable();
        playerControls.Player.Jump.performed -= Jump;
        playerControls.Player.Jump.started -= Jump;
        playerControls.Player.Jump.canceled -= Jump;
    }
    public void Jump(InputAction.CallbackContext ctx)
    {

        if (ctx.started) {
            Debug.Log("Tap");
        }
        if (ctx.performed)
        {
            Debug.Log("Hold");
        }
        if (ctx.canceled)
        {
            Debug.Log("Released");
        }
    }```
supple crow
#

You only get callbacks when the state changes

#

consider this

#
if (playerControls.Player.Jump.IsPressed()) {

}
austere grotto
#

If you want to run code every frame, you can use Update

supple crow
#

because Tap and Hold are built-in Interactions you can apply to your actions

#

Tap performs if you press and release the button quickly enough

#

Hold performs if you press and hold for long enough

fleet mural
fleet mural
# supple crow You only get callbacks when the state *changes*

Thx, I change my code to this and it work like a charm now

    void Update()
    {
        if (playerControls.Player.Jump.WasPressedThisFrame())
        {
            Debug.Log("started");
        }
        if (playerControls.Player.Jump.IsPressed())
        {
            Debug.Log("performed");
        }
        if (playerControls.Player.Jump.WasReleasedThisFrame())
        {
            Debug.Log("canceled");
        }
    }
distant raptor
#

for binding? for multiple players? just genuinely curious

fleet mural
ornate saffron
#

the new system is designed with multiple ways to use it, there's nothing wrong with doing that

fleet mural
#

Oh is he asking me why I hard code the input system?

ornate saffron
#

polling like checking per frame in update rather than the other methods like subscribing to events or whatever

distant raptor
fleet mural
distant raptor
#

if(Input.GetKeyDown(KeyCode.A); for example

fleet mural
distant raptor
#

just wondering ur reason

wild plover
#

I'm experimenting with EnhancedTouch and I have some odd behavior ...
For instance the floating joystick is display on its former coordinates one time out of of two
And buttons that i use are triggered also one time our of two

austere grotto
polar carbon
#

Hey, I'm still experimenting with the new Input System and I tried to create a simple scenario of sorts to check some features.

I made a simple "state machine" player that can either be in a fighting mode, building mode or can drive a car. And I wondered how I could handle the input for those modes, as the inputs obviously overlap.
In the end I went with 4 input maps, and toggled them based on the state. Here's that approach visualised

#

You can see which input maps are enabled based on the opacity, and you can see how the events are triggered

#

I'm curious how you all would approach the same issue? Is there some nice and clever way to handle those kinds of "hierarchical" input mode switching better?

austere grotto
#

Put the "shared" actions in a separate action map

#

You can enable more than one at a time

polar carbon
#

Yeah, that's what I am doing as seen in the demo above. I have "Common" for things that are shared between the fighting and building modes

austere grotto
#

That's how I would do it

#

Although I also don't see the harm in having separate actions for the move in the different modes for example

#

The only reason to keep them on one action is if you want rebinding to automatically be the same for them both, but likewise it prevents you from having any different settings on the action for the different movement styles

polar carbon
austere grotto
#

That depends heavily on how your game works

#

I have no idea how similar those things are

#

If they're really always going to work the same way then sure keep it how you have it

#

I'm imagining walking around vs driving, which are usually quite different

polar carbon
#

In this case it's a purely abstract scenario... think Grounded, Raft or something like that

polar carbon
austere grotto
#

Well it's fun to think about purely abstract scenarios but eventually you will make an actual game

polar carbon
#

Yeah, of course. That's why I'm learning how to use the input system properly, because my current way of gathering input does not scale well

#

I'm talking about an abstract scenario because I just picked one that sounded like a "complex enough game mechanic to warrant a bit more complex input map setup"

#

As at this moment among the games I made, I don't have a concrete example that forced me to implement those systems

austere grotto
#

Alright well I would recommend what you have here. I'm not sure what wouldn't scale about it

polar carbon
polar carbon
#

(For context, previously I used either the old input like so Input.GetKeyDown(KeyCode.W) or I used the new input system in a similar way by doing Keyboard.current.wKey.wasPressedThisFrame)

sudden lagoon
#

Thank you for your answer, if you have idea how to get context id to help ignore unnecessary data it would be great.

fierce compass
sudden lagoon
#

Nwm. It seems primary button keeps changing as well and don't fix the issue.........

fierce compass
#

have you changed the input type?

sudden lagoon
#

you mean action type? action type-> pass through and control -> type button.

fierce compass
#

yeah control type

sudden lagoon
#

sorry wrote wrong info. its Delta [Pointer]

#

which should work with mouse or touch the same

fierce compass
#

that's the binding path, i do mean the control type on the action

sudden lagoon
fierce compass
#

try control type touch

#

oh wait that wouldn't work for the others

sudden lagoon
#

Yea, but just tested it does not fix problem either.

fierce compass
#

ok with control type delta, try setting a separate binding for touch control scheme that uses Primary Touch/Delta instead of Delta [Pointer]

sudden lagoon
#

Nope. Still the same behavior. It really seems more like a bug when HTML element is introduced to touch rather than setup problem 😦 as pinch controls works perfectly.

wild plover
austere grotto
wild plover
polar carbon
#

While experimenting with input rebinding I ran into an interesting issue. Mouse input

Typically I can guard my functions using EventSystem.current.IsPointerOverGameObject(); for every action that would typically use mouse buttons. But I want to allow the user to rebind the keys I essentially have to do that check for every single event and input poll (as in .ReadValue.
It's doable but seems a bit annoying, is there a way to add some sort of middleware to the input actions instance? Something like this

playerInputActions.Middlewares.Add((next, ctx) => {
  if (ctx.control.device is Pointer && ...)
    return;
  else
    next();
});
#

I can't see anything like that in the docs tho

supple crow
#

I wonder if you could use an Interaction for this

#

Interactions can change when an action is started/performed/cancelled

#

existing Interactions include things like "Tap" and "Hold"

polar carbon
#

In theory I could, assuming there is no extra data I would have to pass there (likely not)
I could probably do it in code (as in, injecting interactions into the new instance) to avoid a mistake of forgetting to do it in the editor. Would that handle the input polling tho? I would assume so

#

If not, I guess processors are able to handle the polling part

austere grotto
polar carbon
#

It's more likely to be the latter actually. For the former I would probably use the event system directly or I would lock the mouse to be non-rebindable (for consistency with UI)

austere grotto
#

you can do that even for a top down shooter for example

#

I've made custom raycasters in the past to make that easier (with Plane.Raycast)

polar carbon
#

But in some scenarios I found that approach to be rather annoying

#

Especially for clicking on 2D objects... but that's a discussion for a different channel :v

polar carbon
#

I'm exploring the internals of the PlayerInput to understand how it handles the actions asset itself. Any clue why it applies binding overrides like that?

#

it's done as part of InitializeActions method called somewhere in OnEnable (I think)

#

PlayerInput.cs:1204 for those who want to see the context

supple crow
#

I was looking at this very recently, actually

#

(but I also didn't get the point of it)

polar carbon
#

Looking into this code is... scarring. I don't get at all what's the point of this overriding. After all, the maps should be identical due to Instantiate.
And I cannot grasp why the decided to pass parameters to the PlayerInput component via static variables and not something like an Init method

#

-# And at this point I'm kinda terrified of the idea of diving into local multiplayer support next

polar carbon
#

Okay, I'm looking all over the place. Is there a way to find the first binding in an input action that matches a specific device?

#

I'm trying to do a simple rebind of a key, and at this point I am here

var action = actions.Main.A1;
var matchingBinding = action.GetBindingIndex(path: /* ... something here that matches the keyboard */ );

var wasEnabled = action.enabled;
action.Disable();
rebindKeyboardButton.interactable = false;

action.PerformInteractiveRebinding()
    .WithCancelingThrough("<Keyboard>/backspace")
    .WithControlsHavingToMatchPath("<Keyboard>/*")
    .WithTargetBinding(matchingBinding)
    .OnComplete(op =>
    {
        Debug.Log($"Rebound '{action}' to '{op.selectedControl}'");
        op.Dispose();

        if (wasEnabled)
            action.Enable();

        rebindKeyboardButton.interactable = true;
    })
    .OnCancel(op =>
    {
        Debug.Log($"Cancelled rebinding '{action}'");
        op.Dispose();

        if (wasEnabled)
            action.Enable();

        rebindKeyboardButton.interactable = true;
    })
    .Start();
#

If there is any better way, do let me know. Basically I want to grab the first binding matching a specific device (Keyboard/Mouse/Gamepad) and want to interactively rebind it

#

I see MaskByGroup, is that really the only option?

digital wing
#

Is it recommended to use Vector2 value for 2D movement?

#

That's what Unity 6 has by default here

austere grotto
#

anyway - the defaults are just examples

#

pick whatever makes sense for your game

digital wing
austere grotto
#

that's 1d movement

#

Regardless, use whatever makes sense for your game

digital wing
#

ok

wild plover
#

But I already have a joystick on my game. Now I want to improve it so it is "floating' meaning it is hidden when there's no finger on the touch screen and I want to display the joystick where the player pressed

#

EnhancedTouch is convinient cause it fires different calbacks with the coordonates where the player touched the screen

lusty mason
#
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerControls : MonoBehaviour
{
    [Header("Player Settings")]
    [SerializeField] private PlayerInput playerInput;
    [SerializeField] private int playerIndex;


    public Vector2 MoveInput { get; private set; }
    public bool JumpPressed { get; private set; }
    public bool DashPressed { get; private set; }
    public bool AttackPressed { get; private set; }
    public bool CounterAttackPressed { get; private set; }

    private PlayerInputActions inputActions;

    private void Awake()
    {
        // Create new input actions instance for each player
        inputActions = new PlayerInputActions();
        
        // Get the PlayerInput component
        playerInput = GetComponent<PlayerInput>();
        
        // Set the player index based on PlayerInput
        playerIndex = playerInput.playerIndex;
        
        // Switch control scheme based on player index
        if (playerIndex == 0)
        {
            playerInput.SwitchCurrentControlScheme("Keyboard", Keyboard.current);
        }
        else if (playerIndex == 1)
        {
            playerInput.SwitchCurrentControlScheme("Gamepad", Gamepad.current);
        }
    }

    private void OnEnable()
    {
        EnableAllInputs();
    }

    private void OnDisable()
    {
        DisableAllInputs();
    }

    private void EnableAllInputs()
    {
        inputActions.Player.Enable();
        
        inputActions.Player.Move.performed += OnMove;
        inputActions.Player.Move.canceled += OnMove;
        inputActions.Player.Jump.performed += OnJump;
        inputActions.Player.Jump.canceled += OnJump;
        inputActions.Player.Dash.performed += OnDash;
        inputActions.Player.Attack.performed += OnAttack;
        inputActions.Player.CounterAttack.performed += OnCounterAttack;
    }

    private void DisableAllInputs()
    {
        inputActions.Player.Disable();
        
        inputActions.Player.Move.performed -= OnMove;
        inputActions.Player.Move.canceled -= OnMove;
        inputActions.Player.Jump.performed -= OnJump;
        inputActions.Player.Jump.canceled -= OnJump;
        inputActions.Player.Dash.performed -= OnDash;
        inputActions.Player.Attack.performed -= OnAttack;
        inputActions.Player.CounterAttack.performed -= OnCounterAttack;
    }

    // Input Action callbacks
    private void OnMove(InputAction.CallbackContext context)
    {
        MoveInput = context.ReadValue<Vector2>();
    }

    private void OnJump(InputAction.CallbackContext context)
    {
        JumpPressed = context.performed;
    }

    private void OnDash(InputAction.CallbackContext context)
    {
        DashPressed = context.performed;
    }

    private void OnAttack(InputAction.CallbackContext context)
    {
        AttackPressed = context.performed;
    }

    private void OnCounterAttack(InputAction.CallbackContext context)
    {
        CounterAttackPressed = context.performed;
    }
}

I'm trying to set the controls based on the playerIndex

but it's giving me this error

InvalidOperationException: Cannot set control scheme 'Keyboard' by name on user #0 as not actions have been associated with the user yet (AssociateActionsWithUser)
UnityEngine.InputSystem.Users.InputUser.TryFindControlScheme (System.String schemeName, UnityEngine.InputSystem.InputControlScheme& scheme) (at ./Library/PackageCache/com.unity.inputsystem@1.7.0/InputSystem/Plugins/Users/InputUser.cs:520)

austere grotto
#

basically PlayerInputs are going to grab a set of input devices to assign themselves to, you can't really change which devices manually when dealing with a local multiplayer situation

#

you need to either go all in on PlayerInput/PlayerInputManager or don't

lusty mason
polar carbon
austere grotto
austere grotto
polar carbon
#

If so... that kinda sucks. And I'm surprised the API does not account for it

austere grotto
#

But the PlayerInput component is really only intended for local multiplayer and rapid prototyping

meager ginkgo
#

How to make multiple PlayerInputs work using the same device?
My PlayerInputActions are setup like this:

#

Then I have a PlayerInputLogger prefab with a PlayerInput component using my PlayerInputActions asset and my PlayerInputLogger component:

#

Here's the code for PlayerInputLogger component:

public class PlayerInputsLogger : MonoBehaviour {
    public InputActionReference Action1;
    
    void Start() {
        Action1.action.performed += _ => Debug.Log("Action 1 performed");
    }
}
#

Then, I have PlayerInputsSpawner object and the component in the test scene. Here's the code for PlayerInputsSpawner component:

public class PlayerInputsSpawner : MonoBehaviour {
    public GameObject PlayerInputLogger;

    void Start() {
        PlayerInput Player1 = PlayerInput.Instantiate(PlayerInputLogger, controlScheme: "KeyboardP1", pairWithDevice: Keyboard.current);
        PlayerInput Player2 = PlayerInput.Instantiate(PlayerInputLogger, controlScheme: "KeyboardP2", pairWithDevice: Keyboard.current);
    }
}
#

When I start the game, here's how the scene looks like:

#

It logs only when I press on the G key and not Numpad1 key
When I switch the control schemes on the spawned objects, it logs when I press numpad1 key but not the G key
Only the first instantiated object is working.

meager ginkgo
#

Apparently, the problem is that I use InputActionReference. Once I changed it to just SendMessage and defined OnAction1 on my PlayerInputsLogger:

public class PlayerInputsLogger : MonoBehaviour {
    PlayerInput PlayerInput;
    void Start() {
        PlayerInput = GetComponent<PlayerInput>();
    }

    void OnAction1() {
        Debug.Log($"{PlayerInput.user} Action 1 performed");
    }
}

It started working on both game objects.

austere grotto
#

that's a totally different workflow

meager ginkgo
#

That's just what I've started using when I started using the new input system, I learned it from one of the YT videos or something.

#

Wha about C# events?

#

I see it has option for C# events, how could I make that work?

#

Do I need to define the delegate and the event myself on the PlayerInputsLogger component?

#

Similarly to how I defined the function OnAction1?

austere grotto
meager ginkgo
# austere grotto that's a totally different workflow

But even when I use this InputActionReference, I still need to have the PlayerInput component on that game object and need to have the specific input actions asset selected in it, and then I have to drag the specific action in the editor onto InputActionReference to make it work.

polar carbon
austere grotto
polar carbon
#

I assume you can implement split screen without using that component to still have the static typing benefits, right?
It will just be a tedious work of reimplementing stuff

austere grotto
#

you can still get static typing with UnityEvents mode, but not autocomplete

polar carbon
polar carbon
austere grotto
#

indeed

polar carbon
#

At the very least I would welcome some constants so I can do

playerInput.actions[MyInputActions.Paths.Common.Move]
#

It would be... bad, but better than nothing

meager ginkgo
austere grotto
meager ginkgo
#

I want to be able to get access to performed and cancelled events

#

Not just when it's triggered

#

Is there OnAction1Cancelled message then?

austere grotto
#

It gives an InputAction.CallbackContext from which you can read the phase

polar carbon
#

Because the other two will run into the same problem, I think

austere grotto
#

Depends what you're renaming

polar carbon
austere grotto
polar carbon
#

Looking at your example code, do you even need ValidateAssetConformsToJson(existingAssetInstance);?
Wouldn't throwIfNotFound: true solve it already?

#

I will throw my suggested change into the comment

polar carbon
austere grotto
#

also I think that messes with the device assignment?

polar carbon
#

🤨

austere grotto
#

oh it is yeah, sorry I think it breaks the device assignement stuff though

#

try it out and let me know though!

#

though i think it would need to be:

actions = new MyInputActions();
playerInput.actions = actions.actions;```
polar carbon
#

actions.asset

austere grotto
#

ah yes that

polar carbon
#

Just tested that :v

austere grotto
#

hmm this is slightly promising though?

polar carbon
#

I have to test it later fully, but just checked the compilation

polar carbon
#

I do remeber having some issue with it tho...

#

But maybe I tried something else

austere grotto
#

But I don't remember what it was

polar carbon
#

Okay, before I tried something different

#

But that did not work because the user was not created if there wasn't an asset assigned

#

This could work then

#

Learning this package feels like some kind of adventure... because I have no clue where I would have to look to figure that out from the docs

#

Yeah, the docs don't mention this workflow for some reason

meager ginkgo
polar carbon
#

Yes (tho it's not a good approach, we discussed a better one)

meager ginkgo
#

I've read the chat but I don't understand

polar carbon
#

But it is yet to be fully tested

meager ginkgo
#

I see

#

Yeah, this works:

public class PlayerActionsReporter : MonoBehaviour {
    public PlayerInputActions PlayerInputActions;

    void Awake() {
        PlayerInputActions = new PlayerInputActions();
        PlayerInput PlayerInput = GetComponent<PlayerInput>();

        PlayerInput.actions = PlayerInputActions.asset;
        PlayerInput.user.AssociateActionsWithUser(PlayerInputActions);
        PlayerInput.SwitchCurrentControlScheme(PlayerInput.defaultControlScheme, Keyboard.current);
    }
}
#

Now I can have player input reporter objects adequately and access them in a typed way.

#
public class PlayerInputsLogger : MonoBehaviour {
    public PlayerActionsReporter PlayerActionsReporter;
    void Start() {
        PlayerActionsReporter.PlayerInputActions.Player1.Action1.performed += _ => Debug.Log($"Action1 Performed");
    }
}
#

And have multiple of them and it will work for the same keyboard.

#

Need to make sure that I choose the correct asset in the PlayerInput component.

austere grotto
#

Interesting

meager ginkgo
#

This is working out alright:

public class PlayerController : MonoBehaviour {
    public PlayerActionsReporter PlayerActionsReporter;
    InputAction Movement;
    InputAction Action1;
    InputAction Action2;

    public Character ControlledCharacter;

    void Awake() {
        Movement = PlayerActionsReporter.PlayerInputActions.ActionMap.Movement;
        Action1 = PlayerActionsReporter.PlayerInputActions.ActionMap.Action1;
        Action2 = PlayerActionsReporter.PlayerInputActions.ActionMap.Action2;
        
        Action1.performed += _ => ControlledCharacter.Action1.Start();
        Action1.canceled += _ => ControlledCharacter.Action1.Stop();
        Action2.performed += _ => ControlledCharacter.Action2.Start();
        Action2.canceled += _ => ControlledCharacter.Action2.Stop();
    }
```Then in the Character itself I respond to the actions starting and stopping, too. This way I can have any number of PlayerInput objects even if it's the same keyboard and hot swap them on the player controllers, controller only cares that there's PlayerActionsReporter, and specifically that there's the `PlayerInputActions` class.
#

And everything is typed, so I don't have to work with strings, which is nice.

#

And I can hotswap the controlled character, too, which I do need, because it's a team game.

limpid pecan
austere grotto
limpid pecan
#

Dang I might just have to steal that

meager ginkgo
#

Can I define something like this:

    void Action1(InputAction.CallbackContext CallbackContext) {
        if(CallbackContext.action.phase == InputActionPhase.Performed) {

        }
        if (CallbackContext.action.phase == InputActionPhase.Canceled) {

        }
    }
#

But I can't choose this function in my PlayerInputComponent

#

Oh yeah, there we go:

#
    public void OnAction1(InputAction.CallbackContext CallbackContext) {
        if(CallbackContext.action.phase == InputActionPhase.Performed) {

        }
        if (CallbackContext.action.phase == InputActionPhase.Canceled) {

        }
    }
#

You can use Unity Events for it if you want.

#

Well, that's on the game object that you have PlayerInput on.

#

I had to make the function public to make it work.

#

You can use that Ethan, I guess, but I'd argue against it for the thing you want to use it for, because you'll inevitably write those if statements and do different things depending on the new state and it's more code, more logic and isn't as clean anymore IMO

#

Here Uncle Bob talks about it. Well, kinda, it's about passing booleans but that's our case basically.

limpid pecan
#

I don't think any of the actions in mind would really require it as my suggestion was more aimed at generic vector / float related actions

#

But yeah I completely agree with you when it comes to stuff like buttons

limpid pecan
#

You're gonna have to do an if statement check either way so why not do it in the method?

austere grotto
#

though you can and should use a switch

meager ginkgo
# limpid pecan You're gonna have to do an if statement check either way so why not do it in the...

Not necessarily, I've seen it quite a few times where people write methods with if statements in them and then they call this method in multiple places with true/false arguments.
Instead, you can refactor this method into 2 different methods and call those 2 different methods in 2 different places where appropriate.
Consider this:

  Log(string Message, bool DisplayInViewport) {
    if(DisplayInViewport == false)
      Debug.Log(Message)
    else
      Display.Show(Message);
  }

Then somewhere in our code we call Log("Our Log", false) and in another place we call Log("Out Log 2", true).

This can be cleaner, of course, if we completely remove our Log method and just call Debug.Log(Message) and Display.Show(Message); where appropriate.

#

It's very close to the real life scenario that I saw in a real project:

def log_refresh(message, show=False, do_log=True):
  """
  Print a message and refresh the UI.
  """
  if show:
    show_wait_box(message)
  else:
    replace_wait_box(message)

  if user_cancelled():
    raise Exception("Cancelled")

  if do_log:
    log(message)

That's the one that I could find from the top of my head. And this is a more of a cleaner one where they call functions and there is only one call in an if statement. Sometimes there are tenths or hundredths of lines in each branch.

grim scroll
#

I am using the new Input System with UIToolkit. I have been messing around with components in the scene to understand how they work together. How is it that my buttons can still receive mouse and gamepad input when I have the PlayerInput component disabled, and I also removed the EventSystem and UIInputSystemModule from the scene? I don't understand where the input is coming from

austere grotto
#

it shouldn't work without those.

grim scroll
austere grotto
grim scroll
austere grotto
#

if it's not there - are you sure those are UI Toolkit buttons and not IMGUI?

grim scroll
#

I made it in the UI builder for UIToolkit. Is it possible to have IMGUI buttons in there?

#

Is an event system somehow created under the hood, but does not exist in the scene?

austere grotto
#

I think UI Toolkit must have its own event system

meager ginkgo
#

Does anyone else have a bug where I have to press Listen, press the key and then click on the key 2 times each time?

#

It works only every other time

grim scroll
#

I also tried EventSystem.SetUITookitEventSystemOverride(null, false, false); and that didn't work either. I can still hover and click on the buttons.

austere grotto
#

not using the EventSystem class

grim scroll
#

What I'm trying to achieve is that I want to be able to control when UI can receive input and when it can't. Basically toggling between player and UI mode. I also want to add some custom UI controls that I'm not sure the default UIInputSystemModule supports. I want to be able to use the bumpers on a controller to navigate left and right between tabs, but then use the joystick to navigate the elements within a tab

fresh yarrow
#

Hello. When I click on some buttons in play mode like left ALT or TAB or typical windows button combinations, my system goes crazy because the game in is play mode (it's inside IDE window).
I would like it to act like a separate window because currently I can't do anything in the game because of this crap.

#

For example in Godot when I start the game it catches all inputs and prevents other applications from catching them as well.

#

Imagine when I press CTRL+SHIFT+W in the game and my browser closes with all saved tabs. This is beyond sad.

#

Do you know how to deal with it?

supple crow
#

that sounds like you haven't focused the unity editor

#

your inputs are going to the wrong program entirely

fresh yarrow
#

I have focus on game window. When I spress alt+w, the unity's Window panel pops up

#

and there are many other combinations that makes my game lose focus.

#

I can't even lock the cursor because it just doesn't work. Probably it will work after exporting the game as standalone app.

supple crow
#

cursor locking works fine in the editor

fresh yarrow
#
public void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
}

This surely does not work.

#

and people confirm that in the internet

supple crow
#

does this code actually run?

#

note that you need to actually click on the game view to focus on it

#

it won't grab the mouse automatically

#

(this is an editor-only behavior, along with how hitting Escape always frees the cursor)

fresh yarrow
#

yes exactly, but it should because I order that

#

even if I have a focus I'm losing it after alt+w and other combinations

supple crow
fresh yarrow
#

yes but that's completely not related to my issue

supple crow
#

I think that's just a Windows thing

fresh yarrow
#

ohh no, that's surely not 😉
it's unity that can't deal property with key bindings

#

I will find a way to not use the play mode, it's horrible anyway

supple crow
#

that's a bit like saying you'll find a way to not use the gas pedal..

fresh yarrow
#

I ratehr wait 500% longer and build the whole game every time.

supple crow
#

i don't have a new enough version of unity on my PC to check this, but the little keyboard toggle in the top right of the game view is supposed to toggle unity shortcuts

fresh yarrow
#

it's not, you can test it yourself, the problem is that alt+w is a windows shortcut, not unity

#

building the whole project is a no-go because it takes very long time

polar carbon
#

Is there a way to make this menu... unbroken?
Or is that just what Unity does in a version I am using

#

2022.3.45f with Input System 1.7.0

junior goblet
#

Hey everyone, I'm just getting back to unity for a project after quite a while and I use the "new" input system the first time.
Somehow I'm not sure if I do things right: I want to switch action maps for certain scenarios... fictive scenario would be "switching from player third person controller to a vehicle controller / input action map".

Somehow... this leads me to implementing something like a global solution since I do not want to have the PlayerInput component live on the character gameobject it self... since the player input is something generalist and should persist when the GO of the character is disabled... blablabla...

My Question:

Am I missing some sort of a way to receive the Messages / Broadcasts / Events globally of the new input system?
I do understand that SendMessage broadcasts to the GO it is attached to, Broadcast also to all children... blablabla...

But I was just wondering if there is a globally accessible context or something I'm missing.

fierce compass
polar carbon
fierce compass
fierce compass
polar carbon
#

That would solve this issue, because it would all tie into this system. The car would be "possessed" by the player.
The side effect is that it probably will require some plumbing

#

But that's generally what I used when working with multiplayer (Photon) exactly. Which made things like switching scenes much easier as I could just spawn and assign the avatar to the player that persists all the time

#

Alternative is to do a hybrid version of that approach by having the player be still enabled. Just with a disabled model for example.
That way you can have the player controlling the car

#

-# Again, it's just an educated guess based mostly on the general programming knowledge

polar carbon
#

@austere grotto // Okay, did some test and assigning an asset does in fact work!

#

This is the code I used

private void Awake()
{
    actions = new MyPlayerActions();
    playerInput = GetComponent<PlayerInput>();

    playerInput.actions = actions.asset;

    actions.Walking.Jump.performed += ctx => OnJump();
    actions.Walking.SwitchToCar.performed += ctx =>
    {
        /* ... */
    };

    actions.Driving.SwitchToWalking.performed += ctx =>
    {
        /* ... */
    };

    actions.Walking.Enable();
}
#

There are some edge cases tho. Two that I found are:

  • The player input still tries to enable an action map if you have set one in the past. Even if the enum for that is no longer visible
    So make sure you leave it at "<None>" or throw in playerInput.defaultActionMap = null; for safety
  • If you enable and disable the maps yourself, Player Input's currentActionMap won't be correct as it does not listen to external changes at all
polar carbon
#

Should I check something regarding that approach? As I already have the project open

#

@meager ginkgo

meager ginkgo
#

I don't know, sorry. I'm new to Unity, I didn't encounter those problems yet.

polar carbon
austere grotto
polar carbon
supple crow
#

@inland quail How are you causing OnAim to be called in the code you shared in #💻┃unity-talk ?

#

I believe whatever you're using only calls that method when the action is performed

#

You'd want to react to both the performing and the cancelling of the action

supple crow
#

I want to let the user control the durations for the Tap and Hold interactions

#

I see two ways of doing this:

  • Subclass each interaction type so I can check a setting to get the duration
  • Edit the interactions in my InputActionAsset at runtime
#

The latter feels scary, and I also don't see how I'd actually mess with the interaction objects anyway

#

I also see I could just mess with InputSystem.settings.defaultHoldTime/etc.

fierce compass
#

i guess it really depends on your setup and how you want to provide the control

supple crow
#

Yeah, and I'd like to have actions with non-default hold times

#

So I think I'll just wind up doing a custom interaction type

#

(i might not even try to subclass them -- this will be a copy-pasta operation)

onyx sandal
#

Hello, i made an inventory system by guide on youtube and wanted to change it a bit so i can just press mouse0 anywhere on screen to use item from active slot but for some reason my script just using consumables from whole inventory if there any. I've tried to add check for active slot either to UseItem function and on Update function but it still dont work as i wanted to make it

Here is a logic to change active slot

public void OnPointerClick(PointerEventData eventData)
{
    if (eventData.button == PointerEventData.InputButton.Left)
    {
        OnLeftClick();
    }
}


public void OnLeftClick()
{
    //if (isActive)
    //{
    //    bool usable = inventoryManager.UseItem(itemName);
    //    if (usable)
    //    {
    //        this.quantity -= 1;
    //        quantityText.text = this.quantity.ToString();
    //        if (this.quantity <= 0)
    //        {
    //            EmptySlot();
    //        }
    //    }
    //}

    inventoryManager.DeselectAllSlots();
    selectedSlot.SetActive(true);
    isActive = true;
}

and this is what i've tried

private void Update()
{
    if (InputUtilities.PressButton("Use"))
// its input.getButtonDown function
    {
        if (isActive)
            UseItem();
        else
            isActive = true;
    }
}


public void UseItem()
{
    if (isActive)
    {
        bool usable = inventoryManager.UseItem(itemName);
        if (usable)
        {
            this.quantity -= 1;
            quantityText.text = this.quantity.ToString();
            if (this.quantity <= 0)
            {
                EmptySlot();
            }
        }
    }
}

Also for some reason any time i press mouse0 i receive 8 messages from debug.log if i use it. Not sure why it happens but it also may be part of problem

onyx sandal
#

Update. I found why it called 8 times. I use this script in every hotbar slot and as a half-working solution i find out i can change active slot and waste 1 consumable from currently active slot to change it and next time use from another activate slot

private void Update()
{
    if (InputUtilities.PressButton("Use"))
    {
        if (isActive)
        {
            UseItem();
        }
    }
}


public void OnLeftClick()
{
    inventoryManager.DeselectAllSlots();
    selectedSlot.SetActive(true);
    isActive = true;
}
rose bison
#

Hi! So I am running into an issue where occasionally on script compliation my loading bar will load forever stuck on importing/loading the PlayerInput asset, which is my asset for the new input system for the player. After closing and opening my project I get the console message below:

A default asset was created for 'Assets/Input/PlayerInput.inputactions' because the asset importer crashed on it last time.
You can select the asset and use the 'Assets -> Reimport' menu command to try importing it again, or you can replace the asset and it will auto import again.

I tried doing what the console is telling me but it did not fix it. Was wondering if anyone has had this issue before?

torpid sky
#

i just deleted my XR plugins and it got rid of my input system and now my robot kyle third person controller is going ape

silk warren
#

Hi,
I'm struggling to have my buttons work correctly.
Despite having an event manager, they didn't detect clicks & hovers.
I fixed the hover by adding a graphics raycast to my canvas, but still can't detect clicks. WHat do I need to add ?

austere grotto
#

if the hover is working then the click will work too

silk warren
austere grotto
#

attach a listener function to it with Debug.Log and see if that is working

silk warren
#

Here are my three setups
The function, right now, only outputs to log, but nothing is detected

#

OMG I found it
For some reason the left click was changed

austere grotto
#

oh yeah

#

in your input module

silk warren
#

That lost me so many hours
Thanks for you help, it made me check all of this twice 🙏

#

How do I disable a button ?

austere grotto
silk warren
#

thx

wintry marsh
austere grotto
wintry marsh
#

The gun is connected via USB cable. Using Unity's new input system.

austere grotto
#

Please share code via !code

sonic sageBOT
austere grotto
#

Anyway there's nothing specific to the actual input processing here. It's not clear what kind of input you're expecting to receive from the device and what you're getting instead

#

you should focus on that, outside the context of the game itself, for now.

wintry marsh
#

This gun uses two potentiometers. I was getting raw data from them, but as I tried tweaking the code I ended up with only -1, 0, and 1 readings.

austere grotto
#

how did you get this custom device reading data into Unity?

#

other important thing(s) to show would be the Action configuration for this Gun_Controls action

wintry marsh
#

Project Settings > Input System Package.

#

I had tried making all the settings 0. I set them back to what they were originally.

#

I'll have to get rid of the Deadzone.

supple crow
#

ah, yes, a Deadzone Max of 0 would cause problems

wicked patio
#

I'm thinking about switching to the C sharp events for my input but how would I start listening out for those events?

mossy nacelle
#

Ok, this is not specifically input-system but input manager, when using Input.GetAxis("Horizontal/Vertical" , I noticed that those inputs go from 0 to 1 sorta slowly, I managed to make them go to 1 nearly instantly, but when I let go of the buttons, they slowly decrease to 0, is it possible to make that instant?

fierce compass
mossy nacelle
supple crow
#

I believe that's controlled by the "Gravity" and "Dead" properties

#

well, at least Gravity

mossy nacelle
#

Ok thanks, I will play around with those.

fierce compass
#

yeah deadzone

#

so sensitivity for damping towards the raw input, and gravity for damping towards neutral

wild grotto
#

does anyone know a good tutorial for the new input system?

#

alrady took the unity one and it made me more confused

supple crow
#

what were you looking at, exactly?

primal plover
#

any ideas why my Vector3 Input Actions won't work? I have it set up like normal, but it constantly has a value of (0,0,0)

austere grotto
primal plover
wild grotto
#

how can i be able to have a button to jump with a function similar to getKey? for example, if i hold jump ill be able to continuously jump

supple crow
#

Use an InputActionReference and check if the action is pressed.

supple crow
#

Reacting to a phase change would be inappropriate (you don't care about the action being performed, you care about the button being held down!)

wild grotto
#

thanks!

supple crow
#

I started out using PlayerInput and responding to change events, even for continuous things

#

which was a bit awkward -- I'd have to save the latest value in a field and then check it later

#

Events are good for things like "jump" or "shoot"

wild grotto
#

i see yeah its not that great

supple crow
#

I do everything with InputActionReference now; I subscribe to events for that kind of thing

wild grotto
#

same honestly

supple crow
#

(subscribe in OnEnable, unsubscribe in OnDisable)

wild grotto
supple crow
#

I need to add a convenient way to do both of those automatically

supple crow
#

my game lets you possess any entity, so I do a lot of that

supple crow
#

I like to completely unsubscribe if I don't need an input, instead of just checking if I'm enabled before using it

#

this gets more important with Domain Reload disabled

#

which means Unity doesn't reset the "world" between play sessions

wild grotto
#

sounds about right, but that whole thing about subscribing and unsubcribing with the new input system still has got me a bit confused

supple crow
#

you wind up with event subscriptions from long-dead objects, oops

supple crow
wild grotto
#

as I was writing something my computer crashed from unity

supple crow
#

Subscribing basically just puts your function into a list

#

and everything in the list gets called

wild grotto
#

oh ok, now I get it

#

more straight forward

supple crow
#

The C# documentation hypes up the event keyword a little too much

#

It lets you publicly add and remove methods, but you can only trigger the event privately

#

that's it

wild grotto
#

huh, i thought it did more

supple crow
#

It's very similar to having a public field that holds a delegate type

wild grotto
#

i really really need to read docs

#

and general investigation about stuff

supple crow
#

(and a "delegate" is a function object)

#
public void Wow() {
  Debug.Log("Wow");
}

public void Test() {
  System.Action func = Wow;
  func();
}
#

this logs "Wow"

wild grotto
#

thats interesting

supple crow
#
public void Wow()
{
    
}

public void Test()
{
    System.Action func1 = Wow;
    System.Action func2 = Wow;
    System.Action func3 = func1 + func2;
    func3();
}

my favorite bit is how you can literally just add two of them together

#

(that's what's happening when you subscribe or unsubscribe

wild grotto
#

oohhh thats really handy

supple crow
#

Delegate types let you pass entire functions around

errant minnow
#

I'm having problems getting mouse input to work with input system

errant minnow
#

@austere grotto I'll show u

#

This is my input Action

#

It dose nothing on click or x and y axis

#

What am i doing wrong

austere grotto
#

e.g. mouseX.action.Enable();

austere grotto
#

And you can use a single Vector2 action for mouse x and y, you don't need two separate ones.

errant minnow
#

do I do that in code

austere grotto
#

Do you do what in code

errant minnow
#

mousex.action.enable();

austere grotto
#

I don't know where else you would write code other than in code... 🤔

errant minnow
#

ok thank you

#

@austere grotto it didnt work

austere grotto
#

"it" being what?

#

What did you try?

#

You also have some weird control scheme stuff going on I'm noting.

errant minnow
austere grotto
#

Sure - probably your weird control scheme setup not working now

#

you might also have sensitivity set to 0

#

check both these things

errant minnow
#

It couldn't be It works just fine with old input system. Also I have mouse left and right click on another script and it dosen't work with mouse but works with keyboard button.

austere grotto
#

right

#

this convinces me even more it's due to your weird control scheme setup

#

Why do you have a control scheme called "PlayerInput"

errant minnow
#

Because the keyboard control scheme only has keyboard and I tried adding a new one that has keyboard and mouse

austere grotto
#

you should remove/delete all control schemes unless you are doing local multiplayer

#

It is probably picking the keyboard-only one

errant minnow
#

Yep thank you I deleted keyboard and now it is working. it was picking keyboard

meager ginkgo
#

Is there any info on implementing double tap with the new input system?

fierce compass
#

isn't there an interaction for that

meager ginkgo
#

Thanks. I googled it but it didn't find it, only threads with questions

meager ginkgo
#

I created a default Tap interaction in PlayerInputActions asset.

#

How do I subscribe to it? The document doesn't seem to show it.

#

It shows how to add them:

var Action = new InputAction();
action.AddBinding("<Gamepad>/leftStick")
    .WithInteractions("tap(duration=0.8)");

var Action = new InputAction(Interactions: "tap(duration=0.8)");

But not how to use them.

#

Oh, I see:

fireAction.performed +=
    context =>
    {
        if (context.Interaction is SlowTapInteraction)
            ChargedFire();
        else
            Fire();
    };
meager ginkgo
#

Hmm, it appears the MultiTapInteraction isn't available for Vector2D, which is what I want: I want the character to start sprinting when the X goes above like 0.75 twice in half a second. And I don't care if it's done with a keyboard, gamepad, joystick, wheel or a virtual visual controller on a phone.

#

I guess I'll write my own MultiTapInteraction that works with Vector2.

fierce compass
meager ginkgo
#

Yep.

#

Well, I played video games that supported it myself: Battlefield 3 and Tekken, and those 2 support this kind of a control for sprinting forward

#

Not sure how it will work well for people on the phones

fierce compass
#

apparently L3 is used to initiate a sprint in minecraft for controllers

meager ginkgo
#

I see

#

Double tapping and triple tapping is used a lot in fighting games, it also acts as a balancing mechanics and arguably results in more challenging gameplay compared to "the shift key" approach

fierce compass
#

well, if it feels right when playing then go ahead, i don't play a ton of games lol

meager ginkgo
#

It's actually quite fun do the triple-tap into a button in Tekken

#

Well, Tekken is supposed to be played with a cross but some people control movement with the stick on the gamepad

fierce compass
#

what context is your game in?

#

2d/3d,what perspective?

meager ginkgo
#

It's a top down pseudo 3D sports game with fighting element

#

So like it's a 2D game but with emulated 3D elements, like what people used to do on NES

fierce compass
#

ah, so sprint has to work in all directions?

meager ginkgo
#

Only left and right

#

But without sprint in all 4 directions

fierce compass
#

im kinda struggling to visualize this

#

could you show an example of the perspective?

fierce compass
#

hm, why not sprinting up & down?

meager ginkgo
#

So when you sprint left and right, you can press up and down to do the half circle motion and change the direction

fierce compass
#

so horizontal handling and vertical handling are significantly different?

#

i think in that case it could make sense to just separate them as 2 axis input actions

meager ginkgo
#

Well, they're closer in the normal moving state and then very different in the sprinting state.
So, in the standing still and moving states:

  1. Perform movement in both axes: horizontal and vertical. So Vector2 is very good here.
  2. Player can double tab left or right to start printing.
    Then, in the sprinting state:
  3. Character continues moving the sprinting direction even if player lets go of the controller.
  4. If player enters opposite horizontal direction, character stops sprinting and actually fully stops and moves to the standing still state.
  5. If player double taps up or down, character makes the half circle motion and start sprinting the other direction.
fierce compass
#

yeah i think when sprinting that'd warrant separate actions

#

i don't think that'd be too much of an issue in the normal state

#

you can just combine them

regal osprey
#

Hello there
is there a way to check for input cancellation of a button type action when using Send messages on a PlayerInput?
Like I have this function

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

But it will only "toggle" my _isRunning state, not turn it on while pressed.
Is there a clean way of fixing that?

austere grotto
regal osprey
austere grotto
regal osprey
regal osprey
wintry marsh
#

The problem is not getting a full range of the window when moving the target around. If you watch the video I've attached you'll get an illustration.
My guess is this first has to do with a deadzone that's normally attributed to joysticks. This gun uses two potentiometers and is not a light-gun.
One potentiometer is for the x-axis and the other for the y-axis.
In the video you can see feedback from both in the console window.

fierce compass
#

well if you think it's with the deadzones, have you tried removing them?

wintry marsh
flat widget
austere grotto
flat widget
#

Bumper

austere grotto
#

Seems like the thread covers it

#

Joystick button 4

flat widget
#

Oh you're right. I apologize, I must've missed that.

sturdy jetty
#

how to make keyboard input smoother, like default GetAxis(), because it feels like GetAxisRaw()

wintry marsh
# sturdy jetty how to make keyboard input smoother, like default GetAxis(), because it feels li...

If you're asking a question you should start with: "How do you" or "How does... work" and end with a question mark "?".
Is this what you want to know?
https://www.youtube.com/watch?v=ixM2W2tPn6c

In this video I go over a few methods on how to move a player or an object around the screen. I think share my thoughts on which method is best for each use.
SUBSCRIBE: https://bit.ly/2Js78lE

In this video I discuss:
0:28 - Moving An Object Using Translate
2:20 - Problems with using Translate
2:50 - Using RigidBody for Physics & Co...

▶ Play video
sturdy jetty
#

i need help in context of new input system

wintry marsh
#

Okay, so what is your controller? A joystick, a D pad controller? Or something else?

wintry marsh
sturdy jetty
#

bro you didnt understand me

wintry marsh
sturdy jetty
#

i want to know how to make this feel smoother

wintry marsh
#

What do you want to make smooth?

#

These should be buttons.

sturdy jetty
wintry marsh
#

My guess is that you want an easing effect.

#

Axis is among the choices in this dropdown.

#

Then you assign your key.
Is that what you want to know @sturdy jetty ?

#

Frankly, I'm not sure this will work. But you'll have to spend time trying possible solutions.

#

More settings under Edit >> Project Settings >> Input Manager.

sturdy jetty
#

i fixed it just with lerp

wintry marsh
sturdy jetty
#

(chat gpt doesnt helped)

weak trout
old mason
#

With the input system, how can I check things in a different order? I have UI Toolkit input box, when the user hits a key bound to UI/Console action, I want to check performed on it and block it, before the TextField accepts whatever key they typed. Right now it first writes the character on KeyDownEvent and then it performs my UI/Console event

willow crest
#

Is there a way with the Input System to make hold duration of a button influence the axis output?

Right now the default move action treats WASD as either 0 or 1. I'd like the axis value to slowly ramp up to 1 depending on how long I have the key pressed, so that quick taps allow for fine control.
Is that possible?

supple crow
fierce compass
#

you'd probably have to keep track of that yourself, perhaps with Vector2.MoveTowards

supple crow
#

i.e. they can't remember values over time

#

Interactions can have state, but I'm not sure if you could use that to change the input value

willow crest
#

I'm a bit surprised this isn't the default.. this has been a standard in PC controls for 50 years

fierce compass
#

i mean, the old input system did

#

but it's kind of rigid

willow crest
#

Well, processors can indeed not store state, so those are useless for this usecase

#

If this isn't supported, then the entire input system is pointless for my usecase

#

This is a must have

fierce compass
#

i mean.. you can do anything with code

supple crow
fierce compass
#

the point of the inputsystem is the structure

willow crest
#

Well yeah.. the movement action is 90% of the entire player action. So if fine control with keyboard isn'T possible, then Input System is indeed pointless for me

fierce compass
#

it is possible

#

it's called code

willow crest
#

Code what. THe only way to do this seems with processors and those can't have state

supple crow
#

you just...put the logic in the player controller

#

the input is digital

#

you can respond to it however you want

fierce compass
#

you could use interactions

willow crest
#

The entire point is, that the action output is a Vector2, and that the player controller has no idea what created it.

supple crow
#

It would be a break in the abstraction, yes

#

But I think you've already spent more time worrying about that then you'd have spent just dealing with it (:

fierce compass
supple crow
#

You can figure out what kind of device is producing your input

#

I used to use that to correctly handle mouse delta vs. joystick position

#

(now I use a Processor for that)

willow crest
#

A -1,0 value might be the player pressing A, which needs post-processing, or the player using the joystick at full value, which doesn'T require post processing. If I need to split up the control inputs, then the entire point of the Input System of mapping inputs to actions is gone

#

And again.. if this doesn'T work for movement, which is most of the entire control scheme, then the rest isn't worth it either.. Then I need to look for a different solution, either handmade, or something from the store that supports this

supple crow
#

i'm going to sound a bit mean here

#

but you are giving up incredibly easily on this

fierce compass
supple crow
#

They want the digital input to quickly ramp up to full value instead of instantly going there

#

Much like how the old input manager behaves

fierce compass
#

so that quick taps allow for fine control.
this is the goal, isn't it

supple crow
#

You could approximate it, I guess

willow crest
#

What I'm looking for is the abstraction of the action, sticks being read normally and keys being read based on hold duration

supple crow
#

But it would be a lot less fluid

fierce compass
#

true

willow crest
#

splitting it up is beside the point

supple crow
#

You would still have the bindings together

#

You'd just make an extra decision based on the current device the player is using

#

(that is what I did!)

willow crest
#

No I don't have to punch holes into the abstraction. If this abstraction cannot handle this usecase, then I need a different one

supple crow
#

Okay, then go find something else.

#

You don't seem interested in being helped, which is very frustrating to me

willow crest
#

As I said, movement is the most important thing by far. If that#s not supported then the entire system is pointless to me

fierce compass
#

i mean you could use multiple hold interactions, and then just smooth the output instead

willow crest
#

Well Fen, I told you what solution I need, and all you tell me is that it cannot be done without splitting the abstraction, which is exactly what I don't want

#

I didn't ask how to work around this, I asked how to make this work in Input System. And you tell me that cannot be done

#

So that's my answer

fierce compass
supple crow
#

I don't believe interactions would help you here

#

They don't transform the input value.

#

You'd have to kludge something together out of different tap interactions

#

Which could be transparent, but it'd also be a bit icky to put together

#

It would be easy to make a processor that works for a single player, of course. Just stick some state in a static field

#

It'd just break once you started using that processor multiple times (especially on the same action or binding)

fierce compass
#

seems like stateful processors are slated for v>1

supple crow
#

soon(tm)

#

The current roadblock is that the processor only knows about the value and the InputControl that produced it.

#

If it knew more, it could put its state in a static dictionary

old mason
#

How do I set priority on RegisterCallback<KeyDownEvent> and actions.FindAction("UI/Console").performed? the callback is running first which I do not want

willow crest
vapid hamlet
old mason
#

How can I compare if InputAction.CallbackContext context button pressed using _anyKeyAction = new InputAction(binding: "/*/<button>"); is equal to my _playerInput.actions.FindAction("UI/Console") ?

old mason
#

Using multi language btw, so the "Enter" key is not always called enter when doing context.control.displayName ... how do I check for the enter keybind?

verbal remnant
old mason
#

@verbal remnantI need to block the bound key so it does not write to a UI Toolkit Textfield, but it seems the write always happens before I can catch the press event

verbal remnant
old mason
#

Nothing else is running. The problem seems to be that the input for the Textfield component is always written before I can catch the InputAction.CallbackContext and do something like: ```if (context.control.path == "/Keyboard/backquote")
{
return;
}

verbal remnant
#

I’m saying you should not have to solve it like that

#

You can’t use events to intercept and consume input interrupts in any predictable order

#

You have to prevent the event from happening in the first place, by knowing your game’s mode/state and enabling/disabling actions/maps/controls accordingly

old mason
#

So how would that be possible? My console window is open, the textfield is focused so the user can type into it, but when I hit the console bound key it writes into the input field. There is nothing I can disable? I have no other action maps running, and I don't want to block any other inputs from happening

clear dune
sonic sageBOT
clear dune
#

but those are screenshots

inner belfry
#

I am trying to add controller support for my game, and also allow it to be played on the Steamdeck. Not only would I need to allow the controller joysticks and buttons to work for my player movement, aiming, shooting, but even for the GUI navigation in main menu, character selection, using dropdowns for display resolution, checkboxes etc.

Would you use using the new input system is easy to do this? Or you recommend something like Rewired?

austere grotto
#

any game has these same requirements

#

the gui stuff comes mostly out of the box

inner belfry
#

Awesome, good to hear. I tried playing with Rewired, but couldn't get GUI to work.

#

Does the Unity Input support different controllers and custom mapping?

#

Like something that won't take me months to write on my own?

inner belfry
#

Thank you. I will go through documentation and hopefully don't have to bug you all too much here

supple crow
#

Let me go find the post I made after solving it...

#

Basically, the d-pad would only sometimes work

#

you'd press it 10 times and it'd do something once

#

I do not really understand why this was a problem or why my fix worked -- but my menu controls are working perfectly well on my Deck now

#

normally, the input system tries to only let one control drive the action at a time

inner belfry
#

Was there a step by step tutorial you followed to get it all working from scratch?

supple crow
#

Pass-Through mode makes it not do that

#

Nothing much -- go find the input action asset used by the event system input module, make a copy of it (so you can edit it), switch the "Navigate" action from "Value" to "Pass Through", and then plug that new asset into the input module

#

I'm curious to see if you have the same problem though

inner belfry
#

No, I meant to set up the input system, configure, use it with GUI buttons and navigate through menus etc.

#

Right now, I am doing everything through mouse clicks, and I want to be able to navigate menus and character selection through keyboard and controller

thorny seal
#

Any idea why the composite type when given the multi-tap interaction will always return the midpoint value between min and max?

#

I just want to read which direction (ex. A or D) produced the action, and I have A as positive and D as negative component of the composite

austere grotto
verbal remnant
frank urchin
#

Hello 🙂

My Player Input Manager is firing the Join Behavior on awake even though there are no inputs to the system to tell it to do so. Is there a setting I'm missing?

#

It should be waiting until a controller presses the start button

frank urchin
#

Okay, well I've decided to just handle the joining on my own which works. My last issue that maybe someone can enlighten me on, is that both controllers are controlling both players right now. I currently have two control schemes and each player is assigned to a different one. The control schemes share the same action maps and actions, however. I'm not sure if that is an issue.

inner belfry
#

I am setting the selected gameobject in my Start of my menu scene. To troubleshoot why my controller joystick isn't moving to other buttons, is there a way to Debug.Log what gameobject is currently selected?

 EventSystem.current.SetSelectedGameObject(selectableObject);
#

Unlike with mouse hover, there seems to be no visual indication with controller on which button is currently selected

inner belfry
verbal remnant
inner belfry
#

These values don't work for mouse events? Like hover and pressed?

thorny seal
# austere grotto What do you mean by it "returning" a value? Where are you getting this value?

Since I set the composite type as 1D axis, I was reading the "return value" by using the InputActions.CallbackContext's ReadValue<float>();

Normally without the multitap the read returns min value set in the action map for negative binding and max value for positive binding, but after adding the multi tap interaction every time the Action is triggered the read now returns (min + max)/2 exactly

austere grotto
thorny seal
#

I’ll try a diff way then, maybe individual bindings

inner belfry
#

So playing with this more, I realize that that selecting buttons via controller is completely different from hovering over with a mouse. Is there no way to 'align' them so same events fire? Like playing a sound, and showing details for a character etc?

austere grotto
#

Selecting via controller is the same as selecting via a keyboard

#

But hovering is different

inner belfry
#

Yes, that is what I am trying to achieve -

Hovering over with a mouse will play a sound, brighten the button, scale the button, show character details.

How do I make all this exact same thing happen with selected through controller?

austere grotto
weary coral
#

With the new Input System and with Animator, I have move/jump already set up.
I’m trying to add dancing loops. Does it make sense to make a new state machine graph on another layer? That’s what I have now, and key input is working, but I’m not successfully changing states and my Dance boolean.

verbal remnant
# weary coral With the new Input System and with Animator, I have move/jump already set up. I’...

Input system and animation should not have any direct relationship. You would in all situations put some type of controller between them and that controller implements whatever your application is doing (logic) while using input to understand the player and using animations to implement the response to that input. If you skip that controller you implement your logic in a place that is not designed to implement logic.

raw grove
#

Is there a trick to preventing the input mappings from being garbled for controller on Web builds?

hardy abyss
#

@help ?

glass yacht
#

!ask

sonic sageBOT
inner belfry
#

I got stuff working (both UI and gameplay) with with a controller (xbox controller attached to my PC).

But when I play my game on the SteamDeck, I am having to use the right touchpad instead of joysticks. What am I doing wrong?

onyx halo
#

hey guys I need help

#

how do I handle mouse scroll wheel input?

#

I have an int, and I want it to go up when the mouse wheel goes up, and down when the mouse wheel goes down

#

but I don't really know how this input works, and there aren't really any tutorials going deeply into how it's implemented

austere grotto
#

Also which input system are you using

onyx halo
#

default

#

I wanna access the scroll wheel input in code

austere grotto
#

"default" doesn't mean much

#

New or old

#

The default can be different depending on which version of Unity you're using

onyx halo
austere grotto
#

It explains it pretty well

real prairie
onyx halo
#

so from what I understood, the mouseScrollDelta is a float, going up and down, reseting itself to 0 when the wheel stays untouched

could I use a += to gather the info on how much the wheel has been scrolled?

onyx halo
inner belfry
real prairie
#

What mappings did you use for the controller? Was it specifically like the Xbox controller mappings, or did you use gamepad mappings?

austere grotto
austere grotto
strange sphinx
#

Should I use the new input system for the Essentials bonus scene game?

fierce compass
#

if you feel like it

strange sphinx
#

kinda big docs for it lol

fierce compass
#

well it is a big system

#

but you won't need it all at once

#

one thing at a time

strange sphinx
#

yeah

#

finishing the Essentials soon

#

so it's a package that I need to install in the project first, if I'm not mistaken?

fierce compass
#

yes

paper quartz
#

Pulling my hair out with this one, i'm trying to display bindings for composites ( wasd ). I used the unity example and it shows LS|WASD, but when I use my own action, it shows as blank. My inputs are setup properly, (gamepad, keyboard) is checked. Any ideas? I'm on the most recent version

supple crow
paper quartz
# supple crow how are you displaying the binding?

I do GetDisplayString(n). If I force an index, say 1 it will display W/A/S/D which is correct. If I put a zero, then the gamepad binding of LS will display. When I call the method without any arguments, it shows as blank. Though if i were to switch the binding to a unity example project with another composite "Move" with wasd, calling getdisplaystring will show both the gamepad and keyboard bindings in the string. It's so odd, i feel my input system is not set up correctly, but everything works other than composites!

fallow crane
#

Is there a way with new input system to capture the last move so you idle on the correct side

#

within the animations

fierce compass
#

that's not really a job for the input system

#

rather, in the animation system, just make it not turn when the movement is 0

lavish bluff
#

I have an input action bound to a trigger on my Xbox controller

#

When I press the trigger fully and then release, it calls "started" a second time before it calls "canceled"

#

This is unexpected behavior, how should I work around this?

#

Is it better to use "performed" instead of "started"? That is only called once, when the trigger is fully pressed

austere grotto
lavish bluff
austere grotto
#

Performed is almost always correct but that started behavior is weird

#

Maybe your hardware is doing something weird

lavish bluff
#

Also, it seems like "performed" is called when the trigger is like halfway pressed, but that works for me

austere grotto
#

Yes that's expected

#

You can customize that with a Press interaction if you want

#

The Xbox trigger is not a button it's really an axis

lavish bluff
#

Yeah I figured

#

That has been a pain in many games I've played

#

Also, is there any way to use the gyroscope of a PS4/5 or Switch controller in the input system?

ornate saffron
#

on a real console yes, on a PC without third party drivers i think those are treated as xinput devices which doesn't include a gyroscope

normal parcel
#

Hi. How to do one-time Press in input. Same as Input.GetKeyDown. The .trigger doesn't work at all and I found out there are interactions in Input action menu but Tap or Press still not working

normal parcel
#

I don't have pc with me rn but the wasPressedThisFrame will work?

austere grotto
#

Triggered or WasPerformedThisFrame will both work

#

Assuming you're polling input in Update

#

If you're using events it's different

normal parcel
#

Well the trigger didn't work for me. In interaction I have got the Hold as default. But I will delete this after. Yes but the button which I'm calling was from my void so it wasn't directly in update.

#

Anyway I have seen some kind of void where was something callback. Is it better to have it? Or it just doesn't matter

austere grotto
#

Also they are called "methods" not "voids"

normal parcel
austere grotto
#

Event based input handling vs polling every frame

supple crow
#

Callbacks mean that someone calls your method when something happens

#

Polling means that you have to actively check if something has happened

flint snow
#

Hello there
does anyone know whether PlayerInput isn't supposed to be used on console?
I'm having trouble getting my input device through the component, but it does work properly on PC

austere grotto
#

You probably have a control schemes issue

flint snow
flint snow
#

this is what I have right now

supple crow
#

I'm pretty sure you only get XInputController when using a gamepad on a desktop platform

#

You need a less specific device type

#

If you need things like gyro input, you'll want a specific kind of device

#

otherwise, just use Gamepad

flint snow
flint snow
# supple crow otherwise, just use Gamepad

so if I wanted my game to be released on PC and console and support controller on PC as well, I basically cannot set up my control schemes based on a console platform, am I correct?
Like I can only have one for MKB and one for Gamepad
and anything that requires specific gamepad recognition I'd have to do myself?

supple crow
#

If you want special gamepad features, you already need different control schemes anyway

flint snow
#

But they dont get recognized

supple crow
#

What don't get recognized?

flint snow
#

I cant have a control scheme for Xbox and PS with both a gamepad configured in the device list

#

can I?

supple crow
#

you'd presumably want the specific kind of device for those platforms

#

like "PS5 Controller"

#

so you'd have Mouse + Keyboard, Gamepad, Xbox, and Playstation control schemes

flint snow
#

oh

supple crow
#

I don't know which scheme would win if you used a playstation controller

#

It might be whichever one matches first, in which case Gamepad would go last

#

that'd need testing

fierce compass
#

non xbox/playstation controllers do exist, so you'd probably want a generic fallback one yeah

supple crow
#

indeed -- even on consoles

supple crow
#

are you talking about how your game handles that device?

#

like, what icons it displays?

#

because "Gamepad" is very generic

#

it has nothing specific to an xbox controller in it

flint snow
#

so atm I have control schemes set up per platform, MKB, Playstation and Xbox (cuz they're the targets)
I've managed the game to recognize device changes on PC, so - for exampe - when input from a different device is registered, my button layout changes (standard feature)
and I use PlayerInput for that
so far so good

#

but when I build for xbox or PS, I still receive input just fine from the device, but my device recognition fails
because the control scheme change doesnt trigger

#

so essentially the PlayerInput component has a null device (or none at all), and a null control scheme at the start on any console

flint snow
desert thicket
#

@austere grotto is this what you meant when you said bind left stick directly?

austere grotto
#

Show a screenshot of the action configuration itself

desert thicket
desert thicket
#

you mean in like the code where i define the actions?

austere grotto
#

Select the action

#

No

desert thicket
mellow fractal
#

Hey everyone, ive been really stressing on this issue where my character doesnt respond to my keyinputs and the character just "march in place". im currently using root motion and below are the pictures for context

#

here is my character controller script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BasicMoveRootMotion : MonoBehaviour
{
private Animator animator;
//public settings
public float rotateSpeed = 50.0f;

void Start()
{
    animator = GetComponent<Animator>();
}

void Update()
{
    animator.SetFloat("Vertical", Input.GetAxis("Vertical"));
    if (Input.GetAxis("Vertical") != 0)
    {
        if (Input.GetAxis("Horizontal") > 0)
        {
            transform.Rotate(0, rotateSpeed * Time.deltaTime, 0);
        }
        if (Input.GetAxis("Horizontal") < 0)
        {
            transform.Rotate(0, -rotateSpeed * Time.deltaTime, 0);
        }
    }
}

}

austere grotto
#

You need to pick and stick with one or the other

#

Also you are using transform.Rotate directly on an object with a Rigidbody, which is going to cause issues like broken interpolation.

#

Anyway there's nothing in your code that would make the animator respond to any input.

#

The only thing your code is doing is rotating the Transform.

#

Which may itself even be getting overridden by the Animator.

mellow fractal
austere grotto
#

yes

#

I assume you're trying to move via the animator

#

that's the only reason to tick that box

#

You said you're using root motion

#

im currently using root motion

mellow fractal
#

So the solution would be to untick the rigid body?

#

But doing so would eliminate the characters gravity

austere grotto
#

what do you mean by "untick"?

#

No I'm not saying that's teh solution necessarily

#

I'm saying from what you've shown you have more than one movement strategies in use and also no actual code that will move anything

mellow fractal
#

Ah

#

I see

austere grotto
#

Which box?

#

Rigidbody cannot be disabled.

#

I would say removing it is one option, certainly

mellow fractal
#

Ah

#

I see

austere grotto
#

But I'm not sure what you're actually trying to do or how you actually plan to move the object

mellow fractal
#

Yeah i meant removing it

austere grotto
#

So I can't recommend any particular course of action yet.

#

In general if you want an animated character that moves via Rigidbody, the visual elements of the object should be on a child object

mellow fractal
#

Im planning to move the character by AWSD key and using the animations imported from mixamo

austere grotto
#

so that the animator is not trying to move the root object

#

Root motion should be rare.

normal parcel
#

hi I need help

#

my action for no reason does not accept .trigger or wasPressedThisFrame

#

how to fix it?

supple crow
#

I presume you're talking about InputAction

#

I'd guess that you don't actually have an InputAction

normal parcel
#

I do

#

the IsPressed works fine but the trigger does not

#

for no reason

#

this is for what?

#

What is the purpose of this

mellow fractal
#

and you are correct im trying to make a rigidbody character that is animated

normal parcel
fierce compass
viral flicker
#

why doesnt up and down on the sticks on a controller get recognised on web builds?

hardy furnace
#

I've got a Player Input component set to "Invoke Unity Events" , and I have a button mapped to call a function on a component. I put a log in that function, and every time I hit the button it is being called more than once! Depending on which function I put there, it could be 3 times, or 2 times! What's up with that?

austere grotto
#

Make sure you have an InputAction.CallbackContext ctx parameter on the method and you can do this to understand what's happening:

Debug.Log($"Action phase is {ctx.phase}");```
stiff sand