#🖱️┃input-system

1 messages · Page 61 of 1

brave gyro
paper tusk
#

It's like this: if I press to move and the flag is false, the player won't move. If I keep it pressed and the flag is set to true (with the Move key pressed), the method isn't called, it'll only be called if I press it again... Would there be a way to subscribe ir so it's called WHILE the move key is pressed, not only WHEN I press it? Sorry about the confusion...

brave gyro
#

i'd make key down set on=true and key up set on=false. then if(on) move();

#

basically remember the key is down between frames.

#

really, it doesn't have a way to query the state of keys ?

paper tusk
#

Sounds like a good solution... I'll try it out, thanks!

molten nest
#

oddly enough their snippet doesn't work. InputAction has no definition for onPerformed

#

ill just use the unity default definition for now

brave gyro
#

it might be perform? they have something like start, cancel, and perform. i'm new, I haven't memorized each state.

molten nest
brave gyro
#

ok!

#

I'm trying to understand from InputAction.CallbackContext context how i get the cursor position on the screen.

spark pumice
terse fjord
#

I have a few errors from these codes can yall tell me whats wrong

#

I use Unity 2021.3.2f1 and im making a FPS game

paper tusk
#

Is it normal for an input event be called twice when the input is triggered?

terse fjord
#

idk

paper tusk
#

This "context" log is getting called twice if I press the Jump key (all of them are doing that, so I'm not sure if I did something wrong...)

#

So I get 4 logs, two for 'Performed' and two for 'Canceled'

terse fjord
#

I cant understand this, probably because im new to Unity

paper tusk
terse fjord
#

These ones

paper tusk
terse fjord
#

ok

#

now its five errors

paper tusk
#

These should be inside the class too:

terse fjord
#

The arrows?

paper tusk
#

Move lines 25 to 29 so they're after line 23 (and remove line 30)

brave gyro
#

or remove line 24. same thing.

dire quartz
#
 private void Awake() {
        playerActionControls = new PlayerActionControls();
   playerActionControls.Player.Move.performed += ctx => movementPressed = relativeMovement != 
        Vector3.zero;
}
    private void Update() {
        movementInput = playerActionControls.Player.Move.ReadValue<Vector2>();
}
#

i have a problem when i use a keyboard and press only one button of the movement keys the player doesn't move but when i press two of the movement keys at the same time he moves and then he keeps moving even with one key pressed

#

so its a problem only at the start before he starts moving

#

i don't have this issue with a controller

coral lynx
#

Why InputAction can only be used to press and release keys
I can't keep pressing the key and keep firing the event
This problem comes from the most basic and has been pressing the button to achieve movement

#

GetInput.Player.Move.performed += OnMove;

#

I kept pressing the key and it only responded once so my code like this

shut dew
#

i need to make an up slash in my game and i want the input to be left button (on mouse) and w (on keyboard) but how do i code it so you need to press both to perform that action?

#

using new input system btw

austere grotto
coral lynx
austere grotto
#

Continuous input like movement is best handled by polling. Events are better suited for things like button presses

coral lynx
white quest
#

Yo, I'm trying to make a multiplayer game with the input system, but when a new player is spawned, they are controlled with all devices (So for example, with one player already spawned via controller A, if i use controller B to spawn another player, both players are controlled by controller A AND controller B.) How can I fix this?

austere grotto
austere grotto
#

Someone last week asked the same question and it turned ou they were not actually using the PlayerInput component, they were using the generated C# class which they conveniently named "PlayerInput"

white quest
#

ain't got them mixed up

austere grotto
#

you're using thie PlayerControls object to handle your input

#

that is not using the PlayerInput component

#

if you want it to work properly you have to actually use the PlayerInput component to handle input

#

PlayerControls is your generated C# class

white quest
#

huh. I've been pulling my hair out at this. How can I use the PlayerInput instead then, may I ask?

wise igloo
#

Does anyone else get this issue with the input system. Basically the returned value of this input in this code never resets to 0.
It just keeps the last value it got from the input.

austere grotto
#

for look and move I recommend simply polling in Update instead

#

much simpler

#
void Update() {
  input_Look = playerInputActions.Player.Look.ReadValue<Vector2>();
}```
#

alternatively you can keep your current setup and switch the action to a Pass Through

#

or subscribe to canceled

#

three options for ya

wise igloo
#

Ah ok, so I'll have to subscribe to each event manually to have each stage updated.
Started
Performed
Canceled

It's weird because I've seen similar code reset for others without the canceled event being called.

I've tried the update method as well but for some reason it doesn't update constantly it always hitches unless I move my mouse very slowly then it updates but still hitch.

austere grotto
wise igloo
# austere grotto I gave you three options. Two of them don't involve subscribing to canceled. Hit...

Yea, something might be wrong system wide for me then. I've tried this code in a few new projects and it's the same result.
It's just that one script attached to a game object in the scene and while watching the values in the inspector.
I can see it hitching both when I subscribed to the canceled event, go directly through update, or switch the action to Pass Through as you mentioned.

Thanks for replying and providing a few solutions.
I'm not necessarily sure what's wrong but that's why I wanted to know if anyone else was having this issue.

austere grotto
#

the editor is generally prone to performance hitches in general

#

it could just be that

#

a particluarly long frame will result in a frame with larger mouse input values, which is good and expected

sly frost
#

How Can I Convert Input.GetAxis to Input.GetKey ?

austere grotto
#

Maybe just explain what you're trying to do

#

it depends on what you actually want.

sly frost
austere grotto
#

You can already assign any keys you want in the input manager

#

unless you mean to assign them at runtime

sly frost
#

I am Using Old Input Manager so

austere grotto
#

Obviously

#

input manager is only a thing in the old system

sly frost
#

Like i want to Change it On RunTime

austere grotto
#

Ok that's what I asked

sly frost
austere grotto
#

Your options are:

  • Use the old input system as you are. You'll need to change your code to have separate handling for left and right and up and down instead of one thing for the axis. You'll also need to replicate the "gravity" part of Input.GetAxis.
  • Use the new input system which supports runtime rebinding. This will require a bit of a learning curve because the new system is not that beginner friendly.
  • Use ReWired which is a paid asset.
sly frost
#

How Can i go with the first option any examples

wise igloo
#

I tried another new project and the input worked fine. Also tested it with a basic camera controller and everything's fine, no hitching.
I moved the code back to the old project and got the same issues.
No clue what's causing it but it seems I'll have to move to a new project.

molten bay
#

Hi, I have a project that was working normally but for some reason it started lagging when I move my cursor around.
I've tried disabling all the things in my scene and it didn't solve the issue, has someone experienced this other than me?
Also here is the screenshot from profiler:

brave gyro
#

can i Mouse.leftButton.ReadValue() to get the pressed state?

#

Enenra do you have a git commit from just before the problem started?

molten bay
#

sadly no

#

I was working on another script but I disabled it as well as all the other scripts but that didn't solve the problem

brave gyro
#

ok, well... lesson for next time.

#

what is the last thing you worked on when you saw the problem?

#

can you disable that?

molten bay
#

I did

brave gyro
#

well... keep triaging.

brave gyro
#

git is free, github private repositories are free iirc.

molten bay
#

ok, thanks

brave gyro
#

can i Mouse.leftButton.ReadValue() to get the pressed state?

austere grotto
brave gyro
#

aha, thanks!

solid hatch
#

Hi. I'm having a small problem with New Input System. If someone could help me on DMs that would be great. Thanks!

hexed inlet
#

Anyone have any experience creating custom devices and using QueueDeltaStateEvent for partial state updates?

#

My device gets removed when I call it, so I'm probably using it wrong 😅

paper tusk
#

Guys, is it normal for an input event be called twice when the input is triggered? This "context" log is getting called twice if I press the Jump key (all of them are doing that, so I'm not sure if I did something wrong...)

spark pumice
#

and it will trigger a third time when the button is released with context.canceled = true

#

oh, wait, I just looked at your whole screenshot rather than just the line with the red box. It seems weird that Jump.performed would trigger twice... hmmm....

paper tusk
foggy ginkgo
#

got an tmpro, when im on new input system only, it doesnt find inputfield.text , when im on both it finds the text property

#

why is that so?

austere grotto
#

They're completely unrelated.

shut dew
#

Should i use the new input system or the Old?

foggy ginkgo
#

if new => use old

shut dew
#

Yeah

foggy ginkgo
#

much easier getting started

#

much much easier

shut dew
#

The new is so advanced

foggy ginkgo
#

it uses stuff that even i struggle with and i got some years of coding exp

shut dew
#

I Got some weeks lol

foggy ginkgo
#

coding exp

#

or unity exp

grim niche
#

Hey, is there any neat trick to restore all input actions' state after disabling all of them? I want to have a cheat console and type there freely without performing any gameplay input actions and then re-enable all of the previous input after closing the cheat console. I know I can enable specific input maps but I wonder if Input System can somehow store its state and then read it to enable proper actions so I don't have to check what maps and actions were enabled at the time of disabling them. Thanks.

frail tendon
#

For the new Input Sytem, how do you differentiate between .performed and .canceled when you have it set to SendMessages?

It passes through an InputValue, but what can I do with that to get the .performed and .canceled from it?

austere grotto
#

You don't. It just sends a message for everything

#

You can't tell if it's performed or cancelled

#

If you want to differentiate that you would use one of the other modes

frail tendon
#

so there's no way to detect a buttonUp with sendmessages?

austere grotto
#

I guess look for a zero value? SendMessages is like the dinky prototyping mode

frail tendon
#

ah ok

#

ill just switch it to events then

solid jasper
#

this is a far shot, but any idea why my Quest 2 VR controller connected through Virtual Desktop will not show "primarybutton" and "secondarybutton" actions? the "primary/secondarytouched " actions work, as do other actions such as grip and trigger. this is unity 2021.3.3f1 but it was also broken in 2020. menu accessed from Window->Analysis->Input Debugger.

#

this just started happening after not touching the project for a month, before that it worked

#

by "not show X actions" I mean that I press the physical button but the value in unity doesn't change from a 0 to a 1 as it does for other actions

jagged wyvern
#

I have an action map for gameplay and UI
should both be active at the same time?

#

seems like a lot of trouble to enable and reenable maps whenever I implement a UI feature

toxic pawn
#

they CAN both be active, just depends on what behavior you want the game to have

#

doesn't ui often do input handling above the map level -- and it only trickles down to the gameplay which uses maps if it wasn't already consumed (like by a modal popup)

#

idk how much of that applies to unity

jagged wyvern
#

idk

#

working with the new input system is so consusing

austere grotto
winter basin
#

I have implemented camera controller using new input system for touch input and I want to implement it for keyboard/mouse input as well. Keyboard/mouse input actions are different from touch system completely. I cannot define one input action with different binding for them.
What is your suggestion? Define separate input control for each or action maps to handle keyboard/mouse and touch inputs?

CameraInputControl
  Movement_Touch (ActionMap)
  Movement_Keyboard_Mouse (ActionMap)
  //...
CameraInputControl_Touch 
CameraInputControl_Keyboard_Mouse
winter basin
#

😐

zealous quail
#

Hi, how can I determine the device used from a CallbackContext? and is there an enum for the devices??

#

particularly trying to make a look funtionality for both controller and mouse. I'll need two different sensitivities

crystal helm
#

I'm currently using rewired as my input system manager but for whatever reason all of a sudden it isn't detecting inputs for my pro controller over bluetooth. Any ideas what might be causing this? It was working fine like a week ago but I tried testing it on the same project a week later and the button presses aren't being detected. I can post a link to my repository if it's helpful.

pearl fractal
#

Hi, I'm trying to disable an Action Map when the game is paused but some of the bindings are still being triggered while the game is paused and the Action Map is disabled. Don't know if I'm doing something wrong.

On PauseController.cs, I Disable() player movement and opening a map. The player can't move but I can still trigger opening the map.
_inputManager.InputActions.Player.Disable();

On MapController.cs I check if the map is available and if the player has pressed the binded key.
if (_isMapInteractable && _inputManager.InputActions.Player.ToggleMap.triggered)

I would expect the ToggleMap binding to get ignored if the Player's bindings are disabled but they aren't. There is a binding for player movement that is getting disabled and debugging it returns Player.Move.enabled: False, whereas ToggleMap is always "true". They are both part of the same action map I'm disabling so I'm so confused. I'd really appreciate any help.

zealous quail
#

I have no clue, but some thoughts, are you generating a c# class? Could that be not-updated maybe?

#

and are you disabling when receiving an input from ToggleMap I'm guessing, right? could it be that you're trying to disable while an input is ongoing or something? What happens if you delay the disabling a frame or till next update?

pearl fractal
#

I'll check if there's something wrong with the c# class.

I'm disabling the whole InputActions.Player action map when I press the InputActions.GameState.Pause on another MonoBehaviour but I don't see how they could conflict. At least I have a clue that InputActions.Player.Move is disabling correctly.

I'll check if working around the frame cycle works.

#

Thank you!

zealous quail
crystal helm
#

It's possible, I'll try another one.

#

Tried another and it has the same problem. They're definitely detected but the inputs aren't.

#

The wired controllers work fine as well

zealous quail
pearl fractal
# pearl fractal I'll check if there's something wrong with the c# class. I'm disabling the whol...

I've been cleaning up some old files that I thought could be the issue but still not working as expected. What I have noticed is that only the MapController.cs MonoBehaviour is returning Player.ToggleMap.enabled: True while other scripts with the same reference to the InputManager.cs are returning Player.ToggleMap.enabled: False after disabling.

I'm doing a simple FindObjectOfType<InputManager>() (where I've got the InputActions) so I don't see why one script would show no change while another does show the values toggling.

pearl fractal
hot geode
#

How do I recreate the old input system GetAxis? (not GetAxisRaw)

merry crypt
copper fjord
#

Hey everyone, I have a problem, I am making a game with 2d movement and I am using the input system. When I run it on my computer it works, but when I build it for my iPhone, the ui buttons suddenly stop working. Is anyone else having this problem?
Yesterday it worked fine, but since I updated my iPhone to IOS 15.5 the ui buttons just stopped working.

fathom thunder
#

Hi, gamepad (xbox one and xbox360) work in editor but not in build, using Unity 2019.4.24f1 with Input Sytem version 1.0.2.

https://forum.unity.com/threads/controller-bindings-not-working-after-build.752834/

Anybody figured a solution for this besides building for x86_64 which does not work for me?

bronze arch
#

Can I use IPointerClickHandler in a project that's using the new input system?

willow dawn
#

Hello. I'm using the new input system and am implementing control rebinding. I'm able to detect whether a binding "conflicts" with another binding. I've thought of two ways to handle this - one way is two immediately swap the two bindings OR show the other (conflicting) binding as "empty" to the user. Other than Enabling or Disabling actions, is there a way to assign "null" to a binding or set the override path to point to an empty binding? (do reply to this post so I get the notification from discord)

vague condor
#

I'm trying to set a boolean for my animation condition to go from idle > running. I'm using the new input system, so what should I be checking for? I'm trying to make it change to running via polling if the gamepad action "Move" is currently being performed.

austere grotto
bronze arch
#

Awesome, thank you.

austere grotto
vague condor
#

I was trying to make readvalue of vector2 work, or action.triggered but both cut the animation short without looping

austere grotto
honest sonnet
#

Mouse.current.position.ReadValue() any idea why this could always return 0,0?

#

I also tried to set a manual vector2 for the position, which is also returning 0,0

strange wren
#

This guy has an older version of Unity and it's not the same inputs as im getting, the Composite on mine doesnt have 2D Vector for some reason, Does anyone know why?

#

Idk which one is what the guy selected

austere grotto
#

Then you can pick up down left right composite for the binding

#

(it was renamed)

strange wren
#

Oh ok tysm ❤️ i tried to search on unity documenting but couldnt find

elfin haven
#

Hi Everyone, Im not sure if anyone can help but Im missing the active input handling option in project settings -> Player then under the configuration section. I upgraded unity to 2021.3.3f1 and its still missing. If I make a new project its there. it seems to have been removed from the projects settings menu configuration section entirely. The new input system is installed also and working, just have no way of changing to old, new input or both options anymore.

strange wren
# elfin haven

Im guessing that you can take the new project (project files) and add it into the current project files and it will probably ask you to rewrite or write over the existing and you can just cancel.

stable wing
#

Hello everyone! First time poster here, I’ve been learning unity for a couple of months now, and really enjoying the engine so far (as well as C sharp). I have a question about getting unity to recognize my microphone as an input to inter-text. I’m going to start a thread and explain the problem in more detail if anyone is interested.

granite lion
#

Can i talk about input field here?

strange wren
#

Hello @austere grotto Sorry for disturbing I don't have any rights to do so but I was having an issue after switching over to new input system and the inventory i've made keeps opening and closing at superspeed instead of opening with 1 click,

tame oracle
strange wren
#
 public void Update()
        {

            if (Keyboard.current.tabKey.isPressed)
            {
                if (Keyboard.current.tabKey.isPressed)
                    Cursor.lockState = CursorLockMode.None;

                if (inventoryUI.isActiveAndEnabled == false)
                {
                    inventoryUI.Show();
                    foreach (var item in inventoryData.GetCurrentInventoryState())
                    {
                        inventoryUI.UpdateData(item.Key,
                            item.Value.item.ItemImage,
                            item.Value.quantity);
                    }
                }
                else
                {
                    inventoryUI.Hide();

                    if (Keyboard.current.tabKey.isPressed)
                    {
                        if (Keyboard.current.tabKey.isPressed)
                            Cursor.lockState = CursorLockMode.Locked;

                        if (inventoryUI.isActiveAndEnabled == true)
                        {
                            inventoryUI.Show();
                            foreach (var item in inventoryData.GetCurrentInventoryState())
                            {
                                inventoryUI.UpdateData(item.Key,
                                    item.Value.item.ItemImage,
                                    item.Value.quantity);
                            }
                        }
                        else
                        {
                            inventoryUI.Hide();
                        }
                    }
                }

                


            }

        }
    }

tame oracle
#

This code doesn't use the new input system yet

strange wren
#

Oh what rlly

tame oracle
#

I'll help you through DM!

strange wren
#

Oki

hazy haven
#

hi hi greetings 🖐️
I need a hint for my whole input field, to be able to use Tab button
as a functions of next from one input field to another

#

currently I need to click using left click to go on input field
after we filled previous input field

austere grotto
#

this is the new input system though the other person is wrong about that

gleaming oar
#

yeah might be better to switch to events instead of using the update loop

austere grotto
#

or just use WasPressedThisFrame() instead

tame oracle
#

Hey guys! I got a question as well. Unity tells me: Calling IsPointerOverGameObject() from within event processing (such as from InputAction callbacks) will not work as expected; it will query UI state from the last frame.

I understand what it means, but is there a different new way to check if the mouse is on a UI element?

austere grotto
#

using event system callbacks

strange wren
#
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.EventSystems;

public class InputManager : MonoBehaviour
{
    public ThirdPersonInputActionsAsset playerInput;
    public InputAction inventoryOpen;

    [SerializeField] GameObject inventoryUI;



    void OnEnable()
    {
        inventoryOpen = playerInput.Player.Inventory;
        inventoryOpen.Enable();
        inventoryOpen.performed += OpenInventory;
    }

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

    private void Awake()
    {
        playerInput = new ThirdPersonInputActionsAsset();
    }

    private void OpenInventory(InputAction.CallbackContext openinventory)
    {
        inventoryUI.SetActive(true);

    }



}
austere grotto
#

i mean youve switched to a different input handling style but taken a big step backwards in terms of your code actually doing anything

strange wren
#

is it good or bad ?

#

cause if the case is where it's harder for me to close the UI again which I don't think it is

tame oracle
#

Not everything in your old code is implemented in the new code

strange wren
#

yeah,

fallow haven
#

Is it bad practice to put the Player Input component on multiple game objects within one scene?

#

For example, if I want to have the player be able to interact with an object check for input via the Player Input component rather than having an event sent from the player to the object.

strange wren
#

Or how can I implement WasPressedThisFrame into the code?

#

In update method

dusk onyx
#

So Question; I'm using the new system as Invoke unity events. Subscribing using, InputAction.callbackContext.
how can I create a custom function using the classes in this fire script in another? I've set up an input manager script and a locomotion script.

void FirePerformed(InputAction.CallbackContext context)
{
    // If SlowTap interaction was performed, perform a charged
    // firing. Otherwise, fire normally.
    if (context.interaction is SlowTapInteraction)
        FireChargedProjectile();
    else
        FireNormalProjectile();
}
split bear
#

So I've got a good amount of experience using the new input system on Windows, but I'm working on some new touch controls so I can port one of my desktop projects to mobile. But absolutely none of my touch controls are getting any response when i build to mobile, even stuff that I'm 100% sure works correctly on Windows. Anyone else had this problem? It's a fresh Unity project but with the input actions and scripts copied from another project. Editor version is 2020.3.21f1 and the input system is version 1.0.2

solar sorrel
#

Should I take the time to learn the new input system and convert my old project to use the new input system if I definitely have no plans on using controllers or anything like that?

bitter topaz
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class sc1 : MonoBehaviour {

    public CharacterController controller;
    public float speed = 12;
    public float gravity = -9.81f;
    Vector3 velocity ;
    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;
    public float jumpHeight = 3;

    bool isgrounded;
    void Update () {
        isgrounded = Physics.CheckSphere (groundCheck.position, groundDistance, groundMask);
        if (isgrounded && velocity.y < 0) {
            velocity.y = -2f;
        }
        float x = Input.GetAxis ("Horizontal");
        float z = Input.GetAxis ("Vertical");
        Vector3 Move = transform.right * x + transform.forward * z;
        controller.Move (Move * speed * Time.deltaTime);
        if (Input.GetButtonDown ("Jump") && isgrounded) {
            velocity.y = Mathf.Sqrt (jumpHeight * -2f * gravity);
        }
        velocity.y += gravity * Time.deltaTime;
        controller.Move (velocity * Time.deltaTime);
    }
}
#

@solar sorrel

#

the player isnot jumping

solar sorrel
#

jumpHeight might be too small

#

You’re multiplying the jumpHeight by a really small decimal (time.deltaTime) so the product could be super duper tiny and unnoticeable

#

Also I began unity two weeks ago and I’m probably not the best person to ask 😅

#

Hope it helps though

austere grotto
#

also log jumpHeight of course

bitter topaz
#

how

austere grotto
#

you need to gather more information basically

#

Debug.Log

bitter topaz
#

where is it

austere grotto
#

where is what

bitter topaz
#

i didnt find it

bitter topaz
austere grotto
#

Not sure what you mean by "where is it?"

bitter topaz
#

I think that im stupid

#

ahaaaa

#

i got it

#

@austere grotto?

austere grotto
#

?

bitter topaz
austere grotto
#

What am I supposed to do with that

bitter topaz
#

idk

#

u asked for it

austere grotto
#

Maybe explain what you've done

austere grotto
#

Where in that screenshot is it telling me if the ground check is working

bitter topaz
#

i dont understand

austere grotto
#

We are trying to figure out if your ground check is working

#

You need to log information that tells us if it is or not

bitter topaz
#

i logged it

austere grotto
#

Something like: $"Is touching ground: {isgrounded}"

bitter topaz
#

and that what i got

austere grotto
#

this is not useful information

bitter topaz
shut dew
#

i lose my references when i destroy and instantiate an object how do i fix that

austere grotto
# bitter topaz

ok now keep logging that and see if it matches what's happening in the game

#

it should say true whne you're touching the ground

#

if it doesn't, the grounded check is not working right.

#

also make sure "Collapse" is not turned on in your console window

bitter topaz
austere grotto
shut dew
#

is there any way you can keep references when you destroy and then instantiate an object

austere grotto
#

Is the ground check in the right position?
Is the layer mask correct?
Is the ground's layer correct?

austere grotto
#

they are not the same object anymore there's nothing to "keep"

bitter topaz
#

know what

#

my brain is hurting

#

i wont make it able to jump

shut dew
austere grotto
#

reassign your reference to the new object?

shut dew
#

but i cant really do that in the middle of the game

austere grotto
#

why not

#

myReference = theNewObject;

shut dew
#

because i have a lot of enemies who needs the reference

#

run that in update?

austere grotto
#

of course not

#

run that when you spawn the new object

#

or:

  • use a singleton
  • Use an event that the enemies listen to
shut dew
#

I instantiate multible times so can i make a prefab and make that the new object

austere grotto
#

how are you having your enemies get the reference in the first place?

shut dew
#

Public transform Player;

solar sorrel
austere grotto
austere grotto
#

via making the player a singleton, or a FindWithTag or something

shut dew
#

I have a player tag on him

austere grotto
#

then you can just do that same method of discovery when they find that hte player is null (when it was destroyed)

austere grotto
shut dew
#

Alright so make a transform variable and then do find with tag in the start Function?

solar sorrel
#

Is there an event for each time the Input is updated?

gleaming oar
#

that's how the new input system works

#

you subscribe to the .onperformed events and it will fire off every time that input changes

austere oar
#

My current game has the “player” re spawn when they die (their dead bodies stay around in the world (isDead bool activates and they done move anymore). In the editor this works fine, new one spawns and I can move around. But when I build to WebGL, the newly spawned characters won’t respond to controls. Using the new input system.
anything obvious as a reason for this to anyone?

austere grotto
clever kayak
#

I'm really not sure why it's not detecting my clicks. Any ideas?```cs
private void OnEnable()
{
shoot = inputActions.Powers.Fireball;
shoot.performed += fireball;
shoot.Enable();
}

private void fireball(InputAction.CallbackContext context)
{
    Debug.Log("Fireball!");
}```
austere grotto
clever kayak
austere grotto
#

also show the Fireball configuration

clever kayak
#

The interaction?

austere grotto
#

yes

#

you don't need it

clever kayak
#

This is the fireball

austere grotto
#

get rid of the interaction there too

#

(as per the note)

clever kayak
#

It's still not detecting my clicks

austere grotto
#

Is your OnEnable code running? Verify with a log statement.

#

Do you have any errors in console?

clever kayak
#

Omg... I forgot to attach the script to anything 🤦

#

Now it works just fine

clever kayak
#

Ok so with the new input system, can I do the same as with the old one if I want to find where on the screen the player clicked?

gleaming oar
#

yeah the mouse click usually reads as a vector2 for the x and y

clever kayak
#

Ok Thanks :D

solar sorrel
#

I'm trying to subscribe a certain function to the onActionTrigger() event for the PlayerInput class but I don't see it as a function of the PlayerInput class

austere grotto
# solar sorrel

You're mixing up your generated C# class or your own custom script with the PlayerInput component from input system

#

I think the latter

solar sorrel
#

there's a class called "PlayerInputController" but no PlayerInput..

#

Ahh it's a struct inside the PlayerInputController named PlayerInput

#

I never generated a class though, weird...

mellow plume
#

I'm currently working on split screen local multiplayer, and one issue I've come across is the "correct" way to filter out which device to receive input from for each player. I need to specifically use the generated C# file, not the PlayerInput component. Any ideas?

austere grotto
#

For all other purposes I recommend against PlayerInput but for local multiplayer it's the best.

blissful bridge
#

IPointerExitHandler, IPointerClickHandler and other similar interfaces stopped working after upgrading from 2020.3.25f1 to 2021.3.3f1. Are they discontinued or am I missing something?

austere grotto
#

double check that you still have an event system, you still have a graphic raycaster, and that nothing is blocking the object

blissful bridge
#

Event system updates its "selected item" field when I click on them.

#

Also corresponding unity events work fine, so I doubt it's related to the setup.

austere grotto
#

show the code?

humble sky
#

When someone gets the chance, I have in the player the option to choose which input system i want to use, i set it to both but my problem is that parts of my game that use the old system dont work eventhough it is set to use both

austere grotto
#

how do you know they're not working. What are you expecting the code to do and what is it doing instead?

#

Are there errors?

humble sky
#

when i press the pause button for example it does nothing but moving which uses the new system works just fine

#

and no there are no errors

#

it just dosent do anything

#

also every time i add an actoin to the input action it dosent work even if i have it generate a new script the only thing ive done to get around it is to delete both remake everything and generate the script which is tedious for adding anything to the input thats why ive kept both

tame oracle
#

I forgot the keyword when adding to an event. do we call it "add" or "register"?

#

Event += MyFunc;

humble sky
#

i did some testing and discovered that it is not getting the axis

for example (this is my pausing that isnt working)

if (Input.GetButtonDown("Pause"))
        {
            if (gM.isGameOver == false)
            {
                isGamePaused = !isGamePaused;
                Pause();
            }
        }

i put a debug in and found that it didnt log the message so i think it is not getting the axis

tame oracle
austere grotto
humble sky
austere grotto
#

And can you show your Pause axis in the input manager>?

humble sky
#

the log did nothing

#

and it was all working before i installed the new system

austere grotto
#

can you show the code?

#

ideally the whole script

humble sky
#

ok one sec

#

also the other Input.GetAxis are broke too

austere grotto
#

if you have no log outside the if statement then your Update is just not running

#

it's not an input problem

humble sky
#

mu update runs

#

if not then movement wouldent work which it does work

austere grotto
#

Either Update in this script isn't running
Or there's an error happening
Or you've done somethign with your console window to confuse yourself

#

like put a search term in it

humble sky
#

its in the if (Input.GetButtonDown("Pause"))

#

so i conclude its not getting the axis for some reason

#

also in player the input is set to both

austere grotto
austere grotto
humble sky
#

i thought u ment if (gM.isGameOver == false)

austere grotto
#

I just wanted to see if Update was running

humble sky
#

well ill just mess with it more

#

my laptop is wack

#

most of my problems are bc of it

#

and they require a wack solution

#

ill fix it eventually wuth enough time

tame oracle
#

how can I check if a key is just pressed, or is held down? Example: I only want an event when a key is just pressed .x secs ago, or I want the event to occur every update frame while the key is being held down.

#

how do I do Input.GetKey() and Input.GetKeyDown()

white shard
#

Is there a standard way to make an input do two things with Unity's input system? For instance, I want left click to be how the player both moves and gathers things. Do I just need to do a raycast on my gatherable items to see if the mouse is hovering the gatherables when the left click event is fired?

mortal ridge
#

of course

sand tide
#

Been using unity for ages but never jumped into input land. When it comes to canvas buttons, how do they 'know' I'm left clicking on them? Is this hard coded, or could I switch the 'left click' input to be the 'a' key?

austere grotto
#

That will define which input axes / input actions (depending on which input system you're using) trigger the UI actions

sand tide
#

Ah, I see that object now. Thanks!

mellow plume
tame oracle
#

question... what does this error mean

UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)```
austere grotto
bright valley
#

Hey all I'm super new to unity and c# in general so I'm sorry if this is a dumb question.

I've seen several people use something like

defaultInput.Character.InteractPressed.performed += e => InteractisPressed();

But I've equally seen people using something like defaulatInput.Character.InteractPressed.performed += InteractisPressed;

They seem to behave slightly differently but I see both being used and not once have I seen someone explain why they used their method over the other

#

What are the pros/cons two these to methods (unless one is just flat out wrong, in which case please inform me)

austere grotto
#

Or because they think lambdas are cool or clean looking

#

Or they just saw that example somewhere and don't know any better

mortal ridge
#

no. people use the first one because they do not need access to the input context.
and the correct way to write it would be defaultInput.Character.InteractPressed.performed += _ => InteractIsPressed();

winter basin
#

I have created a custom clamp2d. It is OK but now, I cannot see it in the list
and in an example in unity doc

#if UNITY_EDITOR
        static Clamp2DInputProcessor()
        {
            Initialize();
        }
#endif

        [RuntimeInitializeOnLoadMethod]
        static void Initialize()
        {
            InputSystem.RegisterProcessor<Clamp2DInputProcessor>();
        }

What does it mean? It uses editor preprocessor to call static ctor only in editor but when I run it in the editor, Initialize method executes directly without calling static ctor

sonic pulsar
#

is there a better way to do this?

austere grotto
sonic pulsar
#

ive just decided to go with that

#

perfect

hard wasp
#

My FPS camera keeps seeing the back of my player's head when I look up. Any ideas for a workaround for this? Here's a clip:

austere grotto
hard wasp
austere grotto
#

Or make a headless version or something

hard wasp
outer ermine
#

I have a PlayerInput component on a game object and I want to respond to a mouse button being clicked and when it's released. I have an action map set up, and I have an OnUserAction method being triggered via event broadcast from the PlayerInput component, but I don't know how to identify if it's triggering from a press or a release.

#

The event signature has no arguments.

#

Ahh never mind it's only executing on press at the moment.

#

So I suppose what I am trying to find out is how to detect the input from the button being pressed as well as the release.

#

Sorted this out, needed to look into interactions on input actions.

#

And have an InputValue argument so I could query the state in at the time of the action being triggered.

nimble solstice
#

Hey Everyone! I am having a struggle to make mouse aiming in my sidescrolling platformer with new input system. The thing is, i am trying to do something similiar to this in video: https://youtu.be/-bkmPm_Besk

I have covid atm so apologies if i sound odd in this.
Make sure to subscribe for more content!

Main Channel: https://www.youtube.com/c/bblakeyyy

Patreon with fully explained c# scripts:
https://www.patreon.com/BlakeyGames

NEW SERVER LINK: https://discord.gg/cyskvvyDeH

Silhouette Dash free download:
https://blakey-games.itch.io/silhouette-da...

▶ Play video
#

But right now, i only can read the position of the mouse on a screen

#

i would greatly appreciate if somone could guide me to a good info source on how to make this right

sonic pulsar
nimble solstice
#

A ball to be precise

sonic pulsar
#

have you added shoot input to your input system?

nimble solstice
#

Yes. I have shoothing working on player while pressing "E" but the ball instantiates only in one place in front of a player

#

And I want to change that to be dependent of mouse position

vapid yarrow
#

Hello i use the new input system. I have so my INPUTS scripts where i listen the input action.
And then on my PLAYER scripts i have a reference of my INPUTS scripts for do the action according to what action happen, do you have better solution ?

jagged wyvern
#

what's the solution to the scenario where if I press a button to bring up a window
and the next window expects the same button press for confirmation, it skips confirmation

jagged wyvern
#

tap interaction im guessing?

meager ether
#

What is the current state of the input systems polling API? Are there any ways one can check for any key being pressed? (not to be mistaken for action)

wise igloo
#

Is there a simple way to read a button press like you can with a Vector 2 input?
ReadValue<Vector2>()

hard pulsar
#

example: Mouse.current.leftButton.wasPressedThisFrame

is there something similar to this when the mouse button is held? Ping me if you know

bleak hound
#

Using the new imput system how can I detect mouse scroll up or down? I cannot bind it in any way

#

Also most of the online solutions seems already obsolete since Unity staff said 1 month ago they were changing it

hard pulsar
#

have you tried experimenting with making it a value type? i would see if scroll wheeling returns a value like 1, -1. if it doesnt, i wouldnt know

bleak hound
#

The only thing that work for now is | Value - Vector 2 - Scroll [Mouse] | but then I have to extract the direction via code, as far as I read they were implementing direction reading already in the actions so I can directly trigger an event only when wheel goes down.

hard pulsar
#

if thats works then thats better than nothing tbh

misty zinc
#

a short while after I press play my project stops accepting input for a few seconds, it's happened across multiple projects in different unity versions, Is it a bug with the input system?

tacit igloo
#

Idk if its a problem with the new input system or not but as you can see in the console, i pressed the options buttons 5 times and could open it 2 times.
I'm using the Player Input by using his behaviour set on "send messages" by code.
How is it even possible ? I tried with the Event Trigger but also the Button On Click () method and nothing worked correctly
BUT its working when i use the Pointer Click or my mouse

restive hedge
#

Are there any good tutorials you guys know of that show me how to make a character controller using the new input system? I'm really new to coding so I need it watered down.

teal solar
timid blaze
#

Hi! i got this code for my game :: if (Input.GetKeyDown(KeyCode.X))
which works but, i need the inputsystem version of it. Which is a reference to an input system button from another script,
how do i do that?

timid blaze
#

if (InputAction.(ButtonInteract.triggered))

#

this also doesnt work for example

#

i really dont understand how to call it

zinc stump
#

new input system in the Package Manager has examples you can import and see how it works. There are three different ways shown there

timid blaze
#

ill ask somewhere else, its not in there, gotta spend 8 hours again looking for something someone could tell me in 10 seconds.

zinc stump
#

Documentation is in the pins as well. It's not 10 seconds you need to understand how to set it up and use it

timid blaze
#

but its already set up, it already works. i just dont know how it works when referencing it in within another script

#

if (ButtonInteract.triggered); does it already, but it doesnt work like that in another script outside that class

#

probably dont even need a reference since i can use using UnityEngine.InputSystem;
but still it does not work

radiant shard
#

guys i am using unity new input system

    private void Walk_performed(InputAction.CallbackContext context)
    {
        input = context.ReadValue<Vector2>();
        Walk_animation(input);
    }

    private void Walk_canceled(InputAction.CallbackContext context)
    {
        input = Vector2.zero;
        Walk_animation(input);
    }

    void Walk_animation(Vector2 input)
    {
        animator.SetFloat("InputX", input.x);
        animator.SetFloat("InputY", input.y);
    }
``` when i press W and D , its move north-east with slow movement , not even normalized vector , its my action binding setting
dire quartz
dire quartz
#

what would be a good set up for switching between swimming and ground movement should i just make a new action map for swimming and switch between the two ?

radiant shard
dire quartz
#

nice

#

then on trigger enter the water i switch the action map

#

did you find the problem ?

radiant shard
#

nope

dire quartz
#

i'm fairly new to input system as much as its great its frustrating to learn at first i wish i could help more

radiant shard
#

i wish i had photoshop :((

dire quartz
#

why though

radiant shard
dire quartz
#

lol why not use gimp

radiant shard
#

i am not familiar with interface :(( ,, can't find the option where to go and where to not

dire quartz
#

or if you are used to photoshop workflow there is this website that is just like it literally a ripoff lol but in browser only i use it quite often https://www.photopea.com/

#

try it

dire quartz
radiant shard
#

thanks man :)) you are my hero

subtle igloo
#

can someone help me with multi tap? the tutorial I followed didnt write it like anyone else so I have no idea how to get it to work. It currently just activates as if its single tap. heres how it looks now

crisp bluff
#

hi there, so I'm making a pc game, but I'm wiling to make it compatible to smartphone as well, does anyone know any tutorial about it? Is it too complicated?

jagged wyvern
#

so unity sometimes makes game template projects like the kart racer
is there a project they made that uses the new input system?
i wanna see how they use it

#

i know there's an input sample but that's just for basic movement

jade ether
jagged wyvern
#

already read it

#

too basic

spark wadi
spark wadi
sweet delta
#

oh wait, i think i have not yet installed the input system package 😅 mb mb

subtle igloo
# spark wadi might have something to do with the spacing of the taps?

I made the tap count requirement 5 in the input manager and it was still being detected as pressed when pressed once. Theres got to be more to its set up but I cant tell what I have to do. It has to be that ReadValueAsButton is the incorrect thing to use but Ive tried a bunch of random things to see if anything could work, but nothing has.

analog siren
#

@crisp bluff did you create the prerequisites class?

crisp bluff
# analog siren <@635873426627756032> did you create the prerequisites class?

this is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; 
public class NPC : MonoBehaviour
{
    public GameObject dialogPanel;
    public Text dialogText;
    public string [] dialog;
    public int indexi;
    public float wordSpeedi;
    public bool playerIsClosi;

    void Update()
    {
        if(Input.GetKeyDown(KeyCode.F) && playerIsClosi)
        {
            if(dialogPanel.activeInHierarchy)
            {
                zeroText();
            }
            else
            {
                dialogPanel.SetActive(true);
                StartCoroutine(Typing());
            }
        }
    }

    public void zeroText()
    {
        dialogText.text = "";
        indexi = 0;
        dialogPanel.SetActive(false);

    }

    IEnumerator Typing()
    {
        foreach(char letter in dialog[indexi].ToCharArray())
        {
            dialogText.text += letter;
            yield return new WaitForSeconds(wordSpeedi);
        }
    }

    public void NextLine()
    {
        if(indexi < dialog.Length - 1)
        {
            indexi++;
            dialogText.text = "";
            StartCoroutine(Typing());
        }
        else 
        {
            zeroText();
        }
    }
    private void OntriggerEnter2D(Collider2D other) 
    {
        if(other.CompareTag("Player"))
        {
            playerIsClosi = true;
        }
    }

     private void OntriggerExit2D(Collider2D other) 
    {
        if(other.CompareTag("Player"))
        {
            playerIsClosi = false;
            zeroText();
        }
    }
}
crisp bluff
analog siren
#

So generate the InputActions object in your project first

analog siren
austere grotto
#

but there are better ways to handle things like this in the new system than reading keys directly

crisp bluff
crisp bluff
crisp bluff
limpid pecan
#

I recently upgraded my project to the new input system but whenever I try to move using the joystick it can only go exactly diagonally or vertical and sideways

#

So I can't move it in a circle or anything

#

And I'm not sure what even causes it

#

I'll record an example 2 secs

#

Ignore the background noise

river hazel
#

Boy what the hell

austere grotto
limpid pecan
#

Sorry I'm not even really sure what I should show lol

austere grotto
#

Is how it should be configured

#

now show your code too

limpid pecan
#

That's literally it. I just read the x and y values off of that lol

limpid pecan
granite sun
#

I have a Shoot value but it never seems to update no matter what. It always reports as False. How could I fix this?

jagged wyvern
#

Why value

granite sun
#

because i'm storing a bool value?

jagged wyvern
#

Thats for button

pearl fractal
#

For a Title Screen's "Press Any Key" prompt, how could I set up the InputSystem to detect if keyboard keys are pressed and excluding mouse input?

pearl fractal
#

Thank you @jagged wyvern! I'm checking them out.

jagged wyvern
#

also theres:

#

InputSystem.onActionChange += (obj, change) =>

granite sun
jagged wyvern
#

how are u calling it

granite sun
#

i figured out what the issue was. i wasn't enabling the input

rich beacon
#

So I want to modify that hold time value, that's ticked off default, through code

#

For this I would need a reference to that interaction from that specific action

#

All I managed to achieve was to set/get the value with the input default settings

#
InputSystem.settings.defaultHoldTime = MyValue;

but what if I want to modify that value without changing the default one ?

austere grotto
#

Seems simpler to just implement the hold timer in your code

crisp bluff
#

Hi there, I don't know if anyone has any ideia about it, but in order to make work a key, do I need to make something more beyond the code and the input action? I'm trying to make a npc with a collider that when the player presses a key, it pops up the ui. I tested the ui and it's working fine, just the collision and key thing not working :/

crisp bluff
crisp bluff
ruby hedge
crisp bluff
ruby hedge
#

Oh my

#

Why not use InputActions?

crisp bluff
#

the original part was that

ruby hedge
crisp bluff
crisp bluff
ruby hedge
ruby hedge
shy reef
#

hey guys im trying to make this thing work but it doesnt work at all
i have just a 2d vector WASD in playerinput
and this is my code

using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
    // Start is called before the first frame update
    private Controls control;
    public Rigidbody rb;
    private Vector2 movement;
    public float movementSpeed = 5f;

    private void Awake()
    {
        control = new Controls();
    }

    private void onEnable()
    {
        control.Enable();
    }

    private void onDisable()
    {
        control.Disable();
    }

    private void Update()
    {
        movement = control.Player.Movement.ReadValue<Vector2>();
    }

    private void FixedUpdate()
    {
        rb.velocity = new Vector2(movement.x * movementSpeed, movement.y * movementSpeed);
    }
}

the controls is the inputaction that i created and it has only WASD 2d vector
am i doing something wrong

glass yacht
#

onEnable and onDisable do not exist

shy reef
#

what should i do instead?

glass yacht
#

Use the real methods

shy reef
#

like?

#

what

glass yacht
#

have you tried googling onEnable and onDisable and looking at how you actually write them

shy reef
#

every goddam youtube videos has onEnable and onDisable thing which didnt work
that why im here asking

glass yacht
#

They do not, no youtube video will have onEnable and onDisable

shy reef
#

well the one that ive watched so far to learn this new input thing did

glass yacht
shy reef
#

sorry just figured that it was just a typo lol

split bear
#

Anyone have any idea why my input system code is working fine in the editor but returns zero response when built to Android? I've asked here before but got zero responses, so is there something else I need to include?
I'm using version 2020.3.21f1 and my input system package is 1.0.2

austere grotto
stoic gorge
#

Does anybody know how I can get input from the Primary and Secondary buttons on an XR Controller and detect which controller they were pressed on? I'm using the new input system with the latest XR interaction toolkit and the Action Based XR Rig.

halcyon hound
stoic gorge
halcyon hound
halcyon hound
#

Is it intended behaviour that an InputAction that is referenced in multiple different scripts e.g. via InputActionReferences has to be enabled separately in each script?

crisp star
#

I have a click action and I need to figure out somehow whether smth in UI was clicked during that click
So that would avoid doing game related logic
Any idea how it can be achieved?

delicate estuary
#

[Quick Question]
When using WASD-keaboard input with the new input system and i press W and A or S and D together it delivers (-0.71 , 0.71) and (0.71 , -0.71) . Shouldnt that be normalized? I know that (-0.5 , 0.5) is the same direction just smaller vector scale, but since just W delivers (0,1) i think that the input should be normalized or am i not seing something? Why did they do that?

delicate estuary
fallow vine
#

https://srcb.in/4QZ2Wbs9q9
Im making this input manager ( not sure if its something good to do ) But looks good to make things more clean?

My question is, how do i make my character move without update function?

jagged wyvern
#

If u use rigidbody just feed move vector to it

fallow vine
#

if i use

while(ctx.performed){
Vector2 inputVector = ctx.ReadValue<Vector2>();
// Event to send this value to my PlayerMovement script 
// Then PlayerMovement has a coroutine that moves according to the value 
}

Would that work? or maybe program would crash..

fallow vine
#

no?

jagged wyvern
#

Depends if on input value type

#

Pass through will always perform

fallow vine
#

I dont understand sorry

#

Is it a rigid body method?

jagged wyvern
#

Input binding

fallow vine
#

Ok i cant test it yet but hope it will work

#

thx

#

now it doesnt shows there

#

ye i dont get what he did

#

hes move function is private

#

and he doesnt calls it anywhere

fallow vine
#

Every tutorial i see they use either c sharp events or message thing. Should i use c sharp events instead of unity events?

#

But the problem is that i still dont know a way to make player move without handling input stuff on the player script

fallow vine
#

ok i think i found the solution pretty simple actually, i just thought this wouldnt work

sweet delta
dusk vortex
#

hey all I added an anykey action and I would like to get the keycode on key press , is there any way I can do this using the new input system please?

brisk cove
#

hey I already posted in code-advanced and saw this chat. would this be a good place to ask how to inverse a pinch scale system built on the input-system

nimble solstice
#

Hey everyone! How can i check, if my Mouse.current.position.ReadValue() is negative or positive in script?

jagged wyvern
#

if value < 0

#

or value > 0

woven heron
#

Hi everyone, I'm new here and would like some help with an issue that I've been having. I setup the right stick in the input system (old Unity input system) and I'm trying to get the right stick of my gamepad to move a camera on the X axis but all it wants to do is spin the camera. How could I fix this?

austere grotto
vivid echo
#

Hi, this is being called every time I want to set the pause perms, for some reason even though I'm not pressing the button, its registering input and calling my pause method? What is happening? thanks.

#
        if (dominantGamepadInput != null) Destroy(dominantGamepadInput.gameObject);
        
        dominantGamepadInput = PlayerInput.Instantiate(dominantInputPrefab.gameObject, controlScheme: "Gamepad", pairWithDevice: dominantGamepad);
        dominantGamepadInput.gameObject.transform.parent = gameObject.transform;

        pauseAction = dominantGamepadInput.actions.FindActionMap("Player", true).FindAction("Pause", true);
        pauseAction.performed += context => CheckPause();
runic badger
#

hey guys, so im trying to work with the new input system, and i started off with the default 1st person controller project that unity provides, and im trying to add new inputs, but all of the inputs i add for some reason dont work the same way that the existing inputs work, even tho i copied the code for my new inputs from the existing inputs.

public void OnSprint(InputValue value)
        {
            SprintInput(value.isPressed);
        }
public void SprintInput(bool newSprintState)
        {
            sprint = newSprintState;
        }

these are the existing methods for inputs that actually work,

public void OnInteract(InputValue value)
        {
            InteractInput(value.isPressed);
        }
public void InteractInput(bool newInteractState)
        {
            interact = newInteractState;
        }

and these are the methods i copied and repurposed to my own inputs. the problem is once i press my interact button once, it sets the interact variable to true, but it never sets it back to false once i let go of the button. any ideas on whats happening? (i have added new input actions in my input action asset and initialized the interact variable, just to get that out of the way)

nimble solstice
austere grotto
#

<@&502884371011731486> ^ crypto scam ty

dire quartz
#

the mouse is working like charm with the Ui main menu but no keyboard or gamepad is working

#

this is my canvas if it helps

#

i double checked there are their controls in the Ui action map

dire quartz
#

ok so using the first selected highlights the button when i go into play mode and gmaepad and keyboard works

#

so that's the problem but sadly this won't work in pause menu nor the options menu it only works in the first start menu when the play button is highlighted so i can jump between buttons

austere grotto
dire quartz
lyric steeple
#

Can someone tell me why when i call InputUser.CreateUserWithoutPairedDevices() it creates a user WITH paired devices ?

lost hawk
#

I just wanted to know that does unity have any toggle function to enable and disable any game object
I can just find to play it and stop it.
I want to toggle it
Do I have to do it through script only?

austere grotto
austere grotto
#

Do you have a question?

lost hawk
austere grotto
#

Yep, I answered you above

lost hawk
#

ohk

wild jolt
#

I hope it is the right section

Hello everybody,
I have a problem that I cannot solve.
I have loaded all the scenes in "build settings" but when I start the game the maps do not come out.
the "MainMenu" and the scene to select the "character" exit without any problem. When I select the PG, it spawns in the void, the map is not there. Can someone help me?

#

Thks In advance

elder remnant
#

are there any tutorials on detecting which input device the player is currently using?

remote grail
#

probably a simple question but how do I make it so that when the joystick hits 1 on the x axis it does the movement part 1 time until the stick is back to 0 and then put back to 1

#

like i want it to be like a button where it acts as pressed if it hits 1

#

right now it repeats the block of code I have

#

and comparing it to the previous frame doesnt work

austere grotto
austere grotto
remote grail
#

I figured out a way of doing it but its prob not efficent

#

basically now when theres a bool value called zeroed and when the stick is at 0 for x value it will be true but when the stick hits 1 it sets it to false until its brought back to 0

austere grotto
#

Seems fine

fierce chasm
#

Any good resources for figuring out gamepad-specific values for the input system. I'm trying to get a value that correlates with how far a trigger is pressed.

elder remnant
#

so no one knows how to detect which input device is currently being used? (I just checked Unity Answers, several people have asked the same question but not gotten any replies)

jagged wyvern
#

Inputaction callback context provides it

#

Depends on how your project is set up

#

Alternatively use player input component

split thorn
#

I have an input system setup with "move' and 'jump' - I've got keyboard controls working fine, but adding dpad and controller buttons fails to move the player… Any guidance to getting the controller working would be greatly appreciated

jagged wyvern
#

what action type is move?

split thorn
#

2D Vector - Mode Digital Normalised

#

😄

jagged wyvern
#

is it value, button or passthrough

split thorn
#

Move is Value Vector 2 - WASD = 2D Vector/Digital Normalised / 2D Vector (should be renamed dpad 🙂 ) = 2D Vector/Digital Normalised

#

Let me rename the control schemes

#

Removing the two control schemes - fixed it…

#

Weird

jagged wyvern
#

cool

#

maybe u forgot to save before

split thorn
#

No, I had to remove the two control schemes… that made both sets of controls work

#

Odd, kind of defeats the point of having two control schemes and setting the default to my gamepad setup…

#

I'll try again later…

#

for no my character moves 😄 which is always good!

fierce chasm
spark pumice
# fierce chasm Anyone have an example or link to documentation for finding how how pressed a ga...

https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Gamepad.html

Note: Buttons are also full floating-point axes. For example, the left and right triggers can function as buttons as well as full floating-point axes.

So you just change your trigger mapping from Button type to Axis type and read it like you'd read any other axis. It'll give you 0-1 values (maybe -1 to 1?) depending on how pressed it is.

digital cosmos
#

Uhm i am currently working on a Game and I added Cinemachine and am using the new Input system package but i always get this error message is there a way to deal with it? Or is it just not possible to use cinemachine with the new input system at the same time?

#

thanx

lime mural
#

am i tripping or did TriggerButton used to be called interactUI before? Something changed and my VR controllers are no longer able to click on my world space canvas...

#

is this a steamVR thing?

lime mural
#

this is what it used to look like

neat pebble
#

is time.timescale related to the input system in any way?

#

nvm

warped creek
#

ok so I got a character model with a capsule collider on it. the guy is a bean with feet (not connected to the body). I put 2 box colliders on his feet and they don't collide with anything, his feet just sink through the ground. Anyone know the reason why?

warped creek
#

Yea

icy fiber
#

I'm having trouble getting haptics/rumble working with ps4 controllers. SetMotorSpeeds doesn't seem to be doing anything even though I seem to have a reference to the controller?

icy fiber
#

Any ideas?

crisp star
#

StopPropagation()
Any elaboration on this method?
Description
Stops propagating this event. The event is not sent to other elements along the propagation path. This method does not prevent other event handlers from executing on the current target.

#

I'm seeking for a way to stop input action queue event to execute

#

in case the very first registered callback calls this or maybe smth similiar I'm looking for

covert halo
humble brook
#

Could someone help me understand why my function isn't showing up in the selector here?

#
public void IncomingPlayer(PlayerInputManager.PlayerJoinedEvent context)
    {
        Debug.Log(context);
    }
covert halo
#

attach that script to a game object as a component then drag that object
like we do on buttons events

humble brook
#

i've done that - (it's "GameManager") - but it still won't show my function

glass yacht
#

The types do not match

humble brook
#

i guess i'm misunderstanding how the Player Input Manager is supposed to work. Apologies.

humble brook
#

Can anyone explain what's going on here?

The inputs still seem to work fine regardless of these errors.

#
public void OnBeamInput(InputAction.CallbackContext context)
    {

        if (context.started)
        {
            SetNodeSpeed(0, true);
            beamController.TryBeam(gameObject);
            tryingBeam = true;
        }

        if (context.canceled)
        {
            SetNodeSpeed(0, false);
            beamController.StopTryBeam(gameObject);
            tryingBeam = false;
        }
    }
humble brook
#

LIke this

#

disregard... restarting unity fixed it

warped creek
#

so how would i get a collider for the feet?

#

a hit box, and so my mans feet dont go thorugh the floor

#

so just make the capsule bigger?

#

the problem is that there is no legs, just feet. that would mean you could hit a empty area and it would register a hit

#

doesent a collider work like a hitbox. like if it was shot

#

oh

#

my bad

#

so it doesnt madder the shape of the capsule really

#

just for colliding with objects

fierce parrot
#

so i see there's a new input system

#

is the old one going to be deprecated?

austere grotto
#

There haven't been any announcements about deprecating the old system.

fierce parrot
#

k

austere grotto
#

If you're brand new you should use the old input system, it's the simplest

icy fiber
covert halo
icy fiber
#

:(

glass lark
#

Is there a proper way to use key combinations in the new input system? Like fire a specific action if two keys are pressed at the same time.

jagged wyvern
#

No

glass lark
# jagged wyvern No

So does that mean the only way to check for that sort of situation, is by manually checking? i.e. if(Keyboard.current.shiftKey.isPressed && Keyboard.current.tabKey.isPressed)

#

I'm trying not to do that at all, and let the input system handle everything.

austere grotto
humble brook
#

Can someone point me to some help on how to remove players from my Player Input Manager?

For example, if one player destroys another, I want to remove that player from the game.

foggy ginkgo
#

i got now the new input system setup and on WASD it sends vector3s correct but only on perform and cancel... its for movement so it do that permanently

#

how can i make it that it sends permanently the data

jagged wyvern
#

what

foggy ginkgo
#

i wanted Input.GetKey in new system.. so its executed as long as its pressed... but im done now with new input system..

i make a tiny wrapper around old one.. only had problems with new one

austere grotto
narrow thistle
#

Hey guys how can i port a project of opensourcd github to mobile? Like only the controls. It uses the new input system. I am just confused on how I can port a binding of pc to mobile/touch

sturdy oak
#

so I'm trying to figure out which type of input I am getting

#

and the only way I could figure out was using this janky method-

#
        {
            Debug.Log(playerInput.Locomotion.Move.activeControl.device.displayName);

            switch (playerInput.Locomotion.Move.activeControl.device.displayName)
            {
                // PC and Consoles
                case "Keyboard":
                    ChangeInputType(InputType.PCAndConsole);
                    break;
                case "Gamepad":
                    ChangeInputType(InputType.PCAndConsole);
                    break;
                case "PlayStation Controller":
                    ChangeInputType(InputType.PCAndConsole);
                    break;
                case "Switch Pro Controller":
                    ChangeInputType(InputType.PCAndConsole);
                    break;
                case "Xbox Controller":
                    ChangeInputType(InputType.PCAndConsole);
                    break;

                // VR
                case "LeftHand XR Controller":
                    ChangeInputType(InputType.VR);
                    break;
                case "RightHand XR Controller":
                    ChangeInputType(InputType.VR);
                    break;
            }
        }```
#

and the thing is

#

it works, but it doesn't return "LeftHand/RightHand XR Controller", and instead returns the name of the Oculus Controller that I have

#

so, how should I go about this?

vocal fjord
sturdy oak
#

I am

#

I just need to know what type of controller I'm getting input from

#

I figured out a better way

#
            {
                case typeof(Keyboard):

            }```
#

hopefully it works

#

nope

#

I literally just need to get this value

#

and I can make it work using that

#

or the control scheme

sturdy oak
#

Yeah but

#

For VR controllers

#

It returns Oculus

#

Like

#

The actual name

#

Not, LeftHand XR Controller

#

So I just, for now at least, check if the name contains "XR" in it 😭

#

@west oracle

#

Is there a way to get the binding currently active?

#

And then it's Control Scheme?

vocal helm
vocal helm
jagged wyvern
#

i didn't know that happened, i've been subtracting lambdas this whole time

narrow thistle
#

Hey guys whenever I try to bind a button I get this error:

#
UnityEngine.InputSystem.Controls.TouchPressControl.WriteValueIntoState (System.Single value, System.Void* statePtr) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Controls/TouchPressControl.cs:49)
UnityEngine.InputSystem.InputControlExtensions.WriteValueIntoEvent[TValue] (UnityEngine.InputSystem.InputControl`1[TValue] control, TValue value, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Controls/InputControlExtensions.cs:418)
UnityEngine.InputSystem.OnScreen.OnScreenControl.SendValueToControl[TValue] (TValue value) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Plugins/OnScreen/OnScreenControl.cs:196)
UnityEngine.InputSystem.OnScreen.OnScreenButton.OnPointerUp (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Plugins/OnScreen/OnScreenButton.cs:20)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerUpHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)
leaden sequoia
#

Hi! i'm really new to this input system, and i implemented my battle actions rn. I found this interface worth trying implementing, by myself:

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

public class PlayerController : Entity, PlayerInputs.IBattleActions {
    public static PlayerController Instance;
    public List<Chip> actualChips;
    public Chip BasicAttackChip;
    public Chip BasicDefenseChip;
    public new const EDirection FacingDirection = EDirection.Up;

    private void Awake() {
        Instance = this;
    }

    public void UseActualChip() {
        actualChips[0].ExecuteChip(ActualCase, FacingDirection);
    }

    public void OnMoveRight(InputAction.CallbackContext context) {
        Debug.Log(context);
        MoveToCase(ActualCase.RightCase);
    }

    public void OnMoveLeft(InputAction.CallbackContext context) {
        MoveToCase(ActualCase.LeftCase);
    }
}

Is this not how it works? Bc it seems like it's not doing anything lol

haughty thorn
#

How do I stop my button that is on a disabled canvas from being clicked?

#

When I press the submit button, the button that is on a disabled canvas gets clicked 😦

tranquil knoll
#

mouse delta is way too fast and sensitive. Any solutions people have found?

austere grotto
#

It's also possible you're doing something wrong in your code. One common mistake with mouse input is multiplying it by Time.deltaTime. That is unnecessary and in fact will add unpredictable jitter to the controls.

thorn ridge
#

Hey there. So I need to implement local multiplayer. I have two cars with specific scripts and both have a PlayerInput Component and a script which checks for the input logic like for example this:
if (playerInput.actions["Accelerate"].IsPressed())

Now I have two controllers attached. But when I execute that action (pressing the button) both cars move, but that's exactly not what I want. Anything I missed to setup?

austere grotto
thorn ridge
#

As said, the cars have the PlayerInput Component attached.

#

I tried the PlayerInputManager already, but it did nothing

austere grotto
#

Right but are you spawning them via the PlayerInputManager?

#

That's the key

thorn ridge
#

No I'm not spawning them directly, I set the behaviour to "Join manually" bc the game is setup in a specific way (I'm porting the project)

#

but the InputManager recognizes the PlayerInputs at startup of the scene

austere grotto
#

I'm not an expert exactly on PlayerInputManager but it is typically the piece that handles all the assignment of different players to different input devices

#

if you're not using that you need to do that part yourself - not totally sure how it works

thorn ridge
#

Yeah, so I was told, that#s why I included it.

#

As you see in the Debug Section, it recognizes the PlayerInputs, I dont know exactly why it's numbering that way with #0 and #3 since I think it should be #0 and #1...

#

Does this mean they are joined?

tranquil knoll
austere grotto
#

show the code

#

And what happens instead?

tranquil knoll
#

I do this by having a Vector2, VirtualMousePos which starts at Vector2.zero and then the mouse delta using Input system just does
virtualMousePos += MouseDelta

austere grotto
#

Ok but we need more context. Where is this code running?

#

Can you just share the whole script

#

And maybe a video of what's happening?

tranquil knoll
#

Third direc Func is just a func name btw

#

and this is the problem. When I move the mouse even slightly, the delta sensitivity goes wild

austere grotto
#

Did you use Delta or Position

tranquil knoll
#

Delta

#

ill get a pic

austere grotto
#

Also how are you subscribing this function to the input action?

tranquil knoll
#

and UpdateMousePos just runs ThirdDirecFunc and then returns

#

and under the Binding properties are no Interactions or Processors

austere grotto
#

Can you remove the gamepad and joystick bindings for a minute

#

and also show the Look action itself

tranquil knoll
austere grotto
#

show the part on the right

#

the configuration of it

tranquil knoll
austere grotto
#

Also That looks different from the one above

#

but it looks good

#

TestLooking vs Look?

tranquil knoll
#

this is the binding for TestLooking

tranquil knoll
#

@austere grotto I guess the multiple bindings were throwing it off

austere grotto
#

they get kinda funky

#

you could also have have a joystick that was leaning against a keyboard or something?

tranquil knoll
#

nope, literally just me and my laptop

tranquil knoll
#

idk, its just that when I move my mouse in any direction, my VirtualMousePos moves towards bottom left of the screen

austere grotto
#

what's a (-,-) value

tranquil knoll
# austere grotto what's a (-,-) value

its weird to describe. When I debug.log MouseDelta, it shows support for all four quadrants, but I think that when I do VirtualMousePos += MouseDelta, MouseDelta for some reason acts like its in the negative, negative quadrant

analog siren
#
using UnityEngine;
using UnityEngine.InputSystem;

public class InputManager : MonoBehaviour {
    [SerializeField] private PlayerInput _playerInput;
    public InputAction DebugModeToggle;
    private void Awake() {
        DebugModeToggle = _playerInput.actions["Toggle Debug"];
    }
}```
#
private void Start() {
        GameManager.Instance.InputManager.DebugModeToggle.started += ToggleDebug;
}```
#

Assets/Scripts/GridmapManager.cs(31,9): error CS0123: No overload for 'ToggleDebug' matches delegate 'Action<InputAction.CallbackContext>'

#
public void ToggleDebug() {
        foreach(var item in _tiles){
            if(item.Value.State == Tile.TileStates.Friendly) item.Value.Renderer.color = Color.green;
            if(item.Value.State == Tile.TileStates.Nuetral) item.Value.Renderer.color = Color.yellow;
            if(item.Value.State == Tile.TileStates.Hostile) item.Value.Renderer.color = Color.red;
        }
    }```
#

can someone please tell me why I throw that error?

austere grotto
#

it needs to be an Action<InputAction.CallbackContext>

#

meaning it needs to take a InputAction.CallbackContext parameter

analog siren
#

Oh thats no good

junior spade
#

does Cinemachine input provider z axis input not work for freelook camera?

wraith rapids
#

Hello everyone,

I'm encounter an issue with the new InputSystem and the Controls Changed Events :
I have a scirpt to manage the character movement and I would like to notice the event thaht specified thaht the player is switching between Keyboard+Mouse to a Gamepad mainly for the control of rotation of the player (Mouse or Right Stick)

public void OnDeviceChange (PlayerInput pi)
{
isGamepad = pi.controlSchemes.Equals("Gamepad") ? true : false;

}

But in the Controls Changed Events I don't see my function "OnDeviceChange"

I'm using Unity 2021.0.2f1 and the input System 1.3.0

Can someone please help me ?

proud kayak
#

Hey ppl I have been migrating to the new input system and some of my code is based on "OnMouseDown", OnMouseDrag" and OnMouseUp", I have been looking around for a bit to find good ways to replace this. Because its all related to an Specific object that needs to be clicked on. How would i go about checking this with the new input system ?

shy reef
#

hey guys i wanted to ask one thing
like do we normally define the inputaction everytime we write a new script or its only meant to be instanced once?

rain compass
#

on the YouTube video he named the inputactionreference variable jumpaction reference

#

you named yours inputaction

icy fiber
dry mesa
#

im making a local multiplayer game and am not used to unitys input system. I have everything working except I cant get double jump working because the unity input system is counting me holding it down as a jump is there a way i can make it have to be tapped because it will use up all the double jumps instantly because it counts me holding junp down

bright lagoon
#

I am trying to make a typing game and I have no idea how to do this using Input System. I want to achieve something like this

verbal shadow
#

ayo, so i'm creating a key rebinding system and after a bit of digging, it turns out that if i try to rebind an individual binding of a composite action, unity is going to throw an InvalidOperationException saying that its not possible. Is there truly no way for me to reassign a binding thats part of a composite action?

glass lark
#

Without doing it manually in code ( i.e. Mouse.current.position.ReadValue()) is there a way to get the position in a InputAction.CallbackContext that was fired from a button press?

#

Ah. Never mind. I just switched it around. I made the mouse position the binding and the button the modifier.

steady fable
#

I am fairly new here and this is confusing me cuz I don't have a mental map of where things go yet.

There is a pane of project settings such as the mapping of buttons and axes for the game controller. When I restart the sample game I am using (GameKit) it resets these assignments. Where would I look to find the actual main settings? I am using Cinemachine in this sample. I am trying to fix a bug where the sample is assigning the wrong axis to the game controller

digital cosmos
#

I dont know why but the input system just randomly decided to brake. Has anyone experienced something like this or have i done something wrong?

gleaming oar
#

is it set up as an axis input?

digital cosmos
#

yes

#

Bruh after half an hour searching for the issue i found it there was a space that didnt belong there

#

or its not fixed now it always returns 0 and one Unity restart later everything is fixed restarting>debugging

glass lark
#

Guess I still need an answer to my question. Can you read the modifiers of an InputAction in the code?

tame oracle
#

im using the input actions system and I cant figure out how to make it so when i press a button on a gamepad (from input actions) it does something in my code?

gleaming oar
sharp narwhal
#

Is there anyone who knows how to change the split screen on the Player Input Manager to horizontal?

austere grotto
#

PlayerinputManager doesn't handle split screen

#

That'd be down to your cameras

#

PIM handles assigning input devices and spawning player prefabs

tame oracle
#

can anyone explain what is this?

austere grotto
tame oracle
#

what does it means?

austere grotto
#

It means you tried to access a dictionary with a key that wasn't in the dictionary

tame oracle
#

ohh

#

but all I did was add "w" in the input manager for jump

austere grotto
#

You'd have to look at the stack trace of that error for more information

tame oracle
#

how do I do that?

austere grotto
#

Click on the error and look at the full log of it in the console

#

The full log contains the stack trace

tame oracle
#

ok

#

KeyNotFoundException: The given key '25210' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <d4cde64232cf45659d86aafa597faa77>:0)
UnityEditor.Presets.PresetEditor.DestroyInternalEditor () (at <36f62d8e760b48f7af5d32916f997ce1>:0)
UnityEditor.Presets.PresetEditor.OnDisable () (at <36f62d8e760b48f7af5d32916f997ce1>:0)

#

I don't understand any of this

austere grotto
#

Just looks like a bug in Unity's internal UI code

#

You can ignore it

tame oracle
#

okay

#

thank you

azure fable
#

Hi, i want to share my solution for doing Gamepad and Keyboard inputs with the unity new input system, it's more easy this way in my opinion : https://pastebin.com/urU09HSX

pearl fractal
#

How could I prevent a window from responding to input made on a previous window? I have a "confirm quit game" prompt but it's triggered by previous input. I'd like to know if I can do something right within the input system for these situations.

pearl fractal
#

Thank you @austere grotto! I'll look into that.

tame oracle
#

can someone tell me if i can use a script to swap scenes and where i would have to put it (swap on a key press)

tame oracle
#

ok it seemed more up this ally cause of key stuff but my b

austere grotto
#

"how to detect a key press" is a separate question

tame oracle
#

yea sorry just couldnt really figure out where to put it

pearl fractal
#

@austere grotto I just got around to reading what you shared and it's really useful. However, reading my question again I now think I wasn't clear enough.

#

I have a Quit button on my pause window that prompts another window to confirm if game should quit with a Cancel and Confirm button that are both triggered when triggering the Submit action (Enter key). When I press the enter key to quit the game the confirm prompt is triggered as well because the next button is also waiting for the Enter key to be pressed.

I managed to solve this by resetting the action when opening the new window but I'm not sure that's the cleanest solution:

private void ResetPromptWindow()
{
    _isConfirm = null;
    _inputManager.InputActions.UI.Submit.Reset();
    _inputManager.InputActions.UI.Cancel.Reset();
}

private void Update()
{
    if (_isConfirm != null) return;
    if (_inputManager.InputActions.UI.Submit.triggered)
    {
        // Edit: Deleted this check to avoid confirming when
        // pressing Enter while on Cancel button.
        Confirm();
    }
    if (_inputManager.InputActions.UI.Cancel.triggered)
    {
        Cancel();
    }
}

I think my main issue is not managing correctly the target of the input actions to the currently focused window because I'm also finding out just now that when I trigger the Cancel action (ESC key) the game resumes instead of just Cancelling the quit game prompt. I'd appreciate any tips or resources on this.

stuck sable
#

Alright, is there someone that might be able to help with the new Input System here? I've found a bug in the new Input System and I honestly have no idea how to get around it.

#

The main gist is that if I have 2 keys (doesn't matter which 2 keys) if you hold down the first key and then the 2nd key, if you lift up on the first key Unity never registers it and still thinks that you're pressing the key.

#

I've tried it with multiple keys, multiple actions types, multiple data types, anything and everything has this same behavior and it's a fairly basic behavior that occurs a lot in games. My example is movement, if I want to have walking and then hold shift to run, if the player ever stops holding the movement key while still holding shift they'll run forever.

stuck sable
#

And I can say, the only thing that works is that if the 2nd key is in a different action map then it's fine. So can a single action map only handle a single action at a time (seems silly no?)?

austere grotto
stuck sable
#

There's nothing to the code, its quite literally just an interface implementing the input actions and firing events. I found even weirder, it's just shift that's the issue...

austere grotto
#

there's something to the code, it may be important

#

"Unity never registers it and still thinks that you're pressing the key." - trying to figure out precisely what you mean by this

stuck sable
#
public void OnRun(InputAction.CallbackContext context)
{
    RunEvent?.Invoke(context.phase);
}
#

Quite literally nothing

austere grotto
#

so what is Run and what is bound to it

stuck sable
#

Input Action

#

The class inherits from the Input Actions interface that's generated by InputActions, when you implement it and call .SetCallbacks it will fire your interface as the callbacks for the events registered in the Action maps.

#

Interestingly enough though, it only seems to be when you hold down shift Unity doesn't register any other key presses in play mode.

#

Ah

#

That's silly.

bright meteor
#

Is the input system purposefully designed to fire a cancel event if you have to concurrent inputs that are opposite of each other?

#

For example, If I press the w key and the s key at the same time or the left and right movement buttons at the same time. When I press both a cancel event is called even if I still have the button pressed

glad junco
#

hey, does anyone have a way of taking an XRInput of trigger press and making it do a single action? Currently I'm using the left trigger press to spawn blocks, but since the trigger value is a bool and its in update method it spawns way too many blocks.

#

im thinking something like this, but make it only run BuildBlock once instead of every frame.

civic grove
glad junco
civic grove
olive elm
#

I'm completely new and been looking at various tutorials and guides, when it comes to 2D movement, some seem to use GetComponent<Rigidbody2D>().AddForce(new Vector2(x * speed, y)) and others use GetComponent<Rigidbody2D>().velocity = new Vector2(x * speed, y) - what's the actual difference between .. what i can see being the only difference .. using AddForce in this case vs not. Sorry if this is in the wrong section, if it is please let me know where to move it!

jagged wyvern
# olive elm I'm completely new and been looking at various tutorials and guides, when it com...

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
#

that vid goes into them

olive elm
#

awesome, thank you!

vocal fjord
#

What's the "appropriate" way to navigate a menu with the new input system, like with the unity UI assets (buttons, boxes, etc.) all linked up for tab order? I'm trying to google how to do it, but basically everything i can find ends up pointing me at code using the old input system

frigid ridge
#

At the end of the day it's unlikely fundamentally any different, just collect the equivalent input from the new system.

vocal fjord
#

alright, ill take a look, thanks!

#

yep, looks like that works, pretty much plug and play! thanks!

stuck vapor
#

(for VR) I have been trying to deconstruct the XRBaseInteractable Interactable Event architecture (i.e. Activate event listens for the Activate InputActionProperty InteractionState phase change) in an effort to add my own events.

I'm just wondering if anyone out there has been able to do this? At this point I just need to know its possible so I can keep trying lol

tame oracle
#

what's the recommended way for using touch screen input? new input system touch controls?

#

because i've heard that the old way is recommended for mobile

#

should i use this?

#

how do I get drag, pinch, camera zoom in and out? pinch scroll?

ripe bobcat
#

Is there a easy way to convert my old input system to the new unity input system?

tame oracle
#

otherwise, just use new

#

project settings... its some where in there. might have to google it

ripe bobcat
tame oracle
ripe bobcat
#

Like, i want to add controller support, and its easier with the new input system, but can i even add controller support with the new system and use keyboard with the old system?

#

🤔

tame oracle
#

however, if you can't/don't want to, you can go to project settings and use both old and new input system

#

might take a performance hit, I've no idea.

#

yup, the new input system is designed to replace the old one. try to replace all of they keyboard stuff w/ new input if you can

#

otherwise, start your next project with the new input system. It isn't too hard to learn, I learned it all during a day's time in the middle of a game jam

#

I recommend samyam's tutorial on youtube

ripe bobcat
#

Cus i already have all my scripts with the old system

#

xd

#

and i want to change to the new one, but i have no clue how/where to change my code ;/

#

and no clue what to change it to

ripe bobcat
#

Is it a really really bad thing to use the old input system then?
Or is it still fully usable ?

ripe bobcat
#

But will i have big disadvantages? Or is the new system the same but just easier/more friendly to use 🙂

#

Sorry for all my questions lol, its hard xD

austere grotto
grizzled rapids
#

Good evening, running into an issue where holding the joystick in any position scales the input up to the maximum magnitude in the given direction. I’m using a callback on my InputAction to store the resulting Vector2 from the left stick input

private Vector2 move;

public void OnMove(InputAction.CallbackContext context)
    move = context.ReadValue<Vector2>()

Debugging the value of move here always looks correct - the Vector2 returned by ReadValue has the expected values.

Inside of an Update I read the private variable move and send it’s magnitude to my Animator. If I debug the value of move at the start of the Update function it’s already displaying the unwanted behavior of maxing out the input. So if I’m slightly tilting the stick forward it believes the Vector2 is (0, 1) even though the debug log in the OnMove callback is still showing the correct values. Note that it only happens when I'm holding it at a given position in the 2D vector space - when moving the stick the values are briefly correct until I've held the stick for too long in one spot.

I have tried using FixedUpdate instead of Update and I have made sure that my controller is working otherwise using the input debugger. I made sure I am not assigning to move anywhere outside of the OnMove callback. It's almost like the input is stacking on itself really quickly because I've noticed that the value of move.magnitude grows exponentially in my Update function despite looking 'correct' in the OnMove callback.

Is there something fundamental I’m missing here? Thank you for your time.

spark pumice
fierce parrot
#

what's the difference between horizontal & debug horizontal

coral terrace
#
    public UnityEvent onPress;
    public UnityEvent onHold;
    public UnityEvent onRelease;

I feel like a total scrub. I want to make a simple script that triggers UnityEvents like these. [should be pretty self-explanitory.]

spark pumice
coral terrace
spark pumice
olive elm
#

so i'm seeing a really weird issue with jumping and I really don't understand why.

The jump code i'm using: rb.velocity = new Vector2(rb.velocity.x, jumpHeight); (rb being a reference to rigidbody). I've also added a debug statement above, just printing out 'space pressed'.

When I add the above to Update() (my understanding is that using vector2 should be added here rather than FixedUpdate()), it does work.. kind of. I can see the debug statement being printed in the console every time I press space, but the actual jump only happens about 1/5 times.

I tried the same jump code block in FixedUpdate() just to see what happens. When I did this, i get similar behaviour, except this time the debug is also only printed at the time when the jump is successful vs every time space is pressed(note that the debug statement is before the actual jump code).

What am I doing wrong?

olive elm
#

big facepalm moment, i was using rb.position.y in movement, I changed it to rb.velocity.y and everything works perfectly - I'm not sure why this happens.. so i guess i'll need to do a little reading haha.

left saddle
#
        if(Input.GetKey(KeyCode.LeftShift)){
            if(_pressTime < _pressTimeTollerance) {
                _pressTime += Time.deltaTime;
            }
            else{
                speed = 20f;
            }

        }
        else if (Input.GetKeyUp(KeyCode.LeftShift))
        {
            if(_pressTime < _pressTimeTollerance){
                speed = 10f;
            }

            _pressTime = 0f;
        }```
Im making a sprinting system, I want  `speed = 20f` activate when i HOLD down shift, but instead it requires me to click shift again to turn off sprinting, help?
In the `void update` method
#

also i have these 2 floats

#
    private float _pressTime;
    private const float _pressTimeTollerance = 0.05f;```
vestal pebble
left saddle
#

Ye well I dont think thats how getkeyup works

#

from what ive read, getkeyup activates when im holding a key, but then i stop holding it

vestal pebble
#

Returns true during the frame the user releases the key identified by name.

left saddle
#

Oh

#

So how am I supposed to do this?

#

Im kinda bad at coding

vestal pebble
left saddle
#

if you mean _pressTime, then i use it so Sprinting doesnt activate instantly after clicked shift

vestal pebble
left saddle
#

Alright thanks lemme check it

vestal pebble
#

(the input manager is in project settings)

left saddle
#

Ye ye

#

Yo it works, thanks you!!

ripe bobcat
#

Question

#

Why is it recommended to use the new input system over the old one?

timber robin
#

But it comes at the cost of requiring a more advanced understanding of code, since it's a little abstract (what makes it powerful).

ripe bobcat
timber robin
ripe bobcat
timber robin
#

Sure. Unity has a primer video tutorial on the system on their YouTube channel. Check it out and see

fierce parrot
#

is it bad to still be using the old input system?

cloud anvil
#

hey,can someone tell me how to make basic movement with the input action thing you can download

#

cause im watching a tutorial but its quite old so im not sure if stuff still looks like what tutorial is showing

#

cause its saying to add a 2d vector composite,and i ain't finding the option

austere grotto
#

it's called Up Left Right Down composite now

cloud anvil
#

um,i still dont see it

austere grotto
#

then you will see it

cloud anvil
#

i got negative/positive and one and two modifier

austere grotto
#

you have the wrong action type/control type

cloud anvil
#

got it