#🖱️┃input-system
1 messages · Page 31 of 1
old:
if (Input.GetKeyDown(KeyCode.Space))
new:
if (Keyboard.current[Key.Space].wasPressedThisFrame)```
Because there's no ability to do key rebinding or binding multiple keys or devices to this
but for a quick prototype it's fine
oh, i meant more i want the ability to use the new system but still get that kind of functionality, if that makes sense
yes I understood you entirely, that's what I was responding to
in my view, the new system involves creating an input actions assets and subscribing to the events so that you can do remapping easily
I was unaware of the other parts of it
your view would be wrong. The new input system is very flexible and can be used in many different ways.
but yes, like I said, this approach, which is analagous to the old system which you wanted identical functionality to, does not allow remapping
and event-based stuff is a totally different concept, unrelated to remapping
Another approach that's more like the old Input.GetButton/GetAxis workflow is to use a project-wide actions asset.
then you can do stuff like InputSystem.actions["Jump"].WasPressedThisFrame()
or use event-based handling if you so choose
that one will allow rebinding
ah that method was exactly what i was looking for
alright - well you mentioned the GetKey approach which is more limited than GetButton/GetAxis
if im going to also need the ability to read input on a tick basis, would you recommend just writing my own WasPressedThisFrame() & WasPressedThisTick()
what do you mean by reading input on a tick basis?
like for networking stuff?
you need to read input in Update or with events and cue it up to be included in the next tick
Thats a good approach
Even if it wasnt for networking though, wouldn't people run into issues if they tried to use per frame input on fixed update movement code
nothing about that has changed since the beginning of unity
the same solutions apply
Ok thanks for your time
read input in Update -> consume it in FIxed
Hey peeps - how do I get mouselook to work in Unity 6 with the Input System? It simply refuses to work. Tried:
- Custom Actions > Look = Delta mouse, Delta pointer
- EventSystem > Input System UI module > Point = Player > Look
- CharacterController > Player Input > Events > Player > Look = Controller.onLook
FIXED: I had Simulate mouse as touch in Window > Analysis > Input Debugger > Options, which hid the mouse from Unity
What key binding I have to use for UI Buttons? Because when I used "Primary Touch/Tap" then jump function was getting triggered from anywhere on screen. Do I use Event System or something else instead of using "Primary Touch/Tap" binding in on-screen button component?
You can use anything you want
Are you talking about on screen controls?
Use like Keyboard/J or something
how do I detect what key is pressed under any key thro the input system
there's InputAction.CallbackContext.control if you're using that
im making a grid based roguelike. id like the player to be able to move when pressing a direction key which works for cardinal directions, but I would also like there to be diagnal buttons as well (think numpad movement on older roguelikes)
is there a way to do this with vector 2 input?
or am I better off making seperate inputs for each direction in addition to a vector 2 movement input (lets say if I wanted to use a joystick on a controller)
You mean using 7, 9, 1, and 3 on the numpad to move diagonally?
Or you mean hoilding 8 and 6 simultaneously to move diagonally, for example?
yeah using 7913 as movement buttons essentially.
I almost wanted to have a 'northwest
binding for the action that I could assign
You would need either a separate 2D composite action for the diagonals or 4 separate input actions for the diagonals
and combine that with the cardinal direction input
yeah this is the cleanest solution I can think of too. I appreciate the input
I'm trying to figure out what the "best/correct" way to set up the input actions for me to be able to turn 90 degrees left or right after "bumping" the right stick of a gamepad left or right. Is there a way to make that input work like a digital/button input?
Should I just use a normal axis and check for value within a tolerance range?
What is recommended?
There's a couple options:
- set each direction up as a separate button action
- do a normal Vector2 action and just normalize and disambiguate the direction in your code
okay, went with buttons.
Any idea why the right stick right is triggering as right stick left?
🤦♂️ needed to save the input actions asset after editing it
it works
how can i make one of the input action listen to a runtime vector2 value?
instead of making default buttons/bindings
sry i think i know why, the binding of that virtual joystick plugin was pointer, but i used gamepad left stick to listen to it💀
problem solved ty
I have this issue where when I save the input action editor how it is in the image and when I click on a different tab and a few minutes later the control scheme will change back to keyboard only. How can I fix this?
If it's not a bug and you do have to enable the default map explicitly, is there a better way?
I just came up with this by looking at the autocompletion.
you can call Enable on the InputActionAsset directly to enable all maps
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/api/UnityEngine.InputSystem.InputActionAsset.html#UnityEngine_InputSystem_InputActionAsset_Enable
How do I get a reference to that asset tho?
Like the default asset.
like is this fine?
InputSystem.actions.Enable();
yeah, InputSystem.actions is the default asset, you were getting its maps before
thanks!
quick question , can you override input action value with very random variables/data thats not input value, or have nothing to do with input, not detectable by new input system itself , at least not related to new input system?
i know its a violation tho, but it will save me more efforts if i can do that lol
don't ping specific people for help
sry
I've noticed that my game window mouse value goes insane when I unfocus from the game window. If I'm not cursor locked in the game screen the mouse spins 1000x times and still tracks my mouse movement. Have any of you encountered this? When I'm in the game window, everything works fine
are you moving your mouse over to a monitor with a vastly different resolution?
if its bothering you you can check if the game is currently in focus and ignore all inputs otherwise (which is not a bad idea anyways)
hello! not sure if this is the right channel but i guess its related.
as u can see i tried making a simple dash button.
yet, when pressed, only the debug.log are working, while the rest doesnt. everything from movement, jumping n sprinting works while this doesnt, any idea why?
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
also configure your !ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
•
Visual Studio (Installed via Unity Hub)
•
Visual Studio (Installed manually)
•
VS Code
•
JetBrains Rider
• :question: Other/None
please post all of the script as code
you're probably resetting the linearVelocity elsewhere
my bad holup
can you also Debug.Log(moveinput)
using UnityEngine.InputSystem;
public class playerControl : MonoBehaviour
{
public float speed = 5f;
Rigidbody2D rb;
Vector2 moveinput;
public bool isMoving;
public touchingDir touchingDir;
public int jumpCounter;
public bool isFacingRight;
public bool isFacingLeft;
void Awake()
{
rb = GetComponent<Rigidbody2D>();
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
rb.linearVelocity = new Vector2(moveinput.x * speed, rb.linearVelocity.y);
}
public void OnMove(InputAction.CallbackContext context)
{
moveinput = context.ReadValue<Vector2>();
if(moveinput.x > 0){
isFacingRight = true;
isFacingLeft = false;
} else if (moveinput.x < 0){
isFacingRight = false;
isFacingLeft = true;
}
isMoving = moveinput != Vector2.zero;
}
public void OnRun(InputAction.CallbackContext context)
{
if(context.started){
speed = 10f;
} else if(context.canceled){
speed = 5f;
}
}
public void OnJump(InputAction.CallbackContext context)
{
if(touchingDir.isOnGround){
jumpCounter = 1;
}
if(jumpCounter > 0){
if (context.started)
{
rb.linearVelocity = new Vector2(rb.linearVelocity.x, 5f);
jumpCounter--;
}
}
}
public void OnDash(InputAction.CallbackContext context)
{
if (context.started && isMoving)
{
Debug.Log("Dash");
Debug.Log("move: " + moveinput);
rb.linearVelocity = Vector2.zero;
rb.AddForce(moveinput.normalized * 50f, ForceMode2D.Impulse);
}
}
}
tried checking rigidbody properties but it seems as normal as ever
firstly, do this
then, check this
ah mb didnt see the message
ah, you were right
the dash force was being overwritten by the fixedupdate
just had to make a bool
thank you
Hey folks, I have a question. I'm setting up the player character and noticed that when I call for dodge/jumo/crouch etc. sometimes the input system doesn't register the action. l
ike at one moment I can dodge perfectly 3 times in a row and the next dodge doesn't happen, it's like it's stuck on something(this also applies to jump and others).
I tried to put in the animator transition durations that are small. even put press in the input actions even though it says default is enough, I checked isgrounded in update and nothing is wrong.
For the life of me i can't figure out why it behaves like this, any ideeas?
have you debugged to see if the input listeners themselves are getting triggered?
yup. I gave up on this point for now, advancing the project, spent too much time on it already =))
why does the acceleration not work in mobile?
can you be more specific
I have it set up on my project so when I press 1 it invokes the unity event to place water, but it instantiates 3 of the prefabs instead of just 1
I'm not calling PlaceWater() from aynwhere else, does nayone have an idea what it could be?
but with a Debug.Log in the placewater I see it does get called 3 times somehow
sounds like you're getting 3 calls for the 3 phases, started/performed/cancelled
with the callback context version, make sure to check the phase
(you can easily check that's happening by logging the phase, or holding the button down - you should see 2 calls immediately, then another call when you release)
I've not really used this new input system before took a massive break from unity so i'm not sure how i'd check that, I call it exclusively through the invoke unity event with no code related to button pressing
check what exactly?
this is exactly what happened
then yes the inputsystem is invoking the event for each phase
the callback isn't invoked when it's pressed, the callback is invoked when the state changes
the callbackcontext provides a .phase property iirc?
autocomplete should be able to tell you the correct name if that's not right
ah, there are also bool props you can use, so just .performed
I see, so I will need code to do this I can't just invoke the unity event like I was doing?
your unity event is already code
you just add a condition in the body of the method you're calling
okay i'll look up that thankyou 🙂
Can you guys help me with something real quick? I've been writing something relating to the Input System and somehow it ended up messing up the input... it's all jittery now kind of working like grinding metal against a cheese grinder (that's the best description I can provide because I'm not really able to share a video atm...)
THe update mode is set to dynamic, I've tried to look for all sorts of help but this is a huge issue for me. Can anyone help me out??
You'd have to share details about what you're doing and the nature of the jittering
Most likely a physics object is not being interpolated properly due to your setup
Jittering wouldn't generally be directly input related
Excuse me i have a question,
I try to make 2D Action RPG in Mobile Android but i still don't know about new input system and how to fix my player movement in virtual joystick ?
Because when I use keyboard input, the top down movement is alright.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
[SerializeField] private float moveSpeed = 5f;
private Rigidbody2D rb;
private Vector2 moveInput;
private Animator animator;
void Start()
{
rb = GetComponent<Rigidbody2D>();
animator = GetComponent<Animator>();
}
void Update()
{
if (PauseController.IsGamePaused)
{
rb.velocity = Vector2.zero; // Stop movement
animator.SetBool("isWalking", false);
return;
}
rb.velocity = moveInput * moveSpeed;
animator.SetBool("isWalking", rb.velocity.magnitude > 0);
}
public void Move(InputAction.CallbackContext context)
{
if (context.canceled)
{
animator.SetBool("isWalking", false);
animator.SetFloat("LastInputX", moveInput.x);
animator.SetFloat("LastInputY", moveInput.y);
}
moveInput = context.ReadValue<Vector2>();
animator.SetFloat("InputX", moveInput.x);
animator.SetFloat("InputY", moveInput.y);
}
}
does your PlaceWater function have any arguments?
it looks to me like the motion is fine - it's your animation that is not working properly. Is that correct?
I managed to get it going in the end thankyou though
Yes, I think my animation isn't working properly with joystick virtual and the on-screen stick component (built-in Unity) seems to have a delay in reading it. How to fix it ?
this is the video when i test with a joystick and keyboard, there is a difference in the animator parameter input. https://drive.google.com/file/d/1u03u_t7oxyoKBJwTi2QkgkD78UnnVMrx/view?usp=drive_link
I dug abit more into it, it seemed to be a me issue. I'm still not sure what the cause was but didn't seem to just affect Unity, so I restarted my computer and it worked just fine afterwards 🥲
does anyone here use the new unity input system?
tons
no it's just a joke we're all in on
New Unity Input System isn’t real, it can’t hurt you 
its not real trust
lieessss
i hate the new input system 
takes a few days to figure out how it works
I have an issue with the VirtualMouseInput where on loading a scene with a gamepad enabled, I'm unable to interact with any of my UI. Only until I move my mouse, and then enable my gamepad again does the UI work.
I have a single PlayerInput that doesn't get destroyed when I change scenes. Each scene has a single Event System and UIInputModule, the latter having all the correct input and is being synchronized with the PlayerInput class.
I tried everything from making that UIInputModule a DontDestroyOnLoad object, manually pairing the VirtualMouse device, and even forcing the position of the virtual mouse to be changed through script so that the UIInputModule can pick it up. Nothing's worked so far.
Hello there
is there a way to capture UI navigation events in general?
I'm trying to create as system that can ensure that some Selectable is always selected during UI navigation.
public sealed class EnsureNavigation : MonoBehaviour, IMoveHandler {
public void OnMove ( AxisEventData eventData ) {
}
}
I've tried this but it's not working
what would be the best way of having getting a input from each number with the new input system?
keyboard numbers?
i.e 1, 2, 3, 4 on the top row of your keyboard. (inventory reasons)
you could create some in your input actions
so one for each key...
yeah?
that seems sub optimal.

plus if you want an int to come e.g. then you could make a simple function to check for the input and return the correct num
is this for a hotbar or something?
yep.
having them as separate actions would let you rebind them individually easily
i'd rather have them as one.
how do you plan on detecting them separately then
no. all i need is, was a number pressed if so output the value. (could i use a scale processer)
no the number also please use replies.
well it worked.
How do i check when a layer stops giving input for something like movement using the new input system? I'm not seeing anything on the docs for it
what method are you using for detecting it to begin with?
movement
no, like, PlayerInput, InputActionReferences, polling, a generated class, etc?
PlayerInput
alright, and which behavior is it set to
unity events
you can check for the callbackcontext being "cancelled"
canceled bool property, or check phase as being equal to InputActionPhase.Canceled
im trying to switch over my player movement code to using the new system but its not working as expected https://paste.ofcode.org/KYJkjViQY52hkhciQrvPbc
Currently i cant move forward or backwards and A and D move me super fast in either direction
am i using the input system incorrectly?
velocity.x = targetVelocity.x * gameObject.transform.localScale.x;
velocity.y = Mathf.Clamp(rb.linearVelocity.y, -200, 10);
velocity.z = targetVelocity.z * gameObject.transform.localScale.z;```
multiplying by the scale here is weird
That’s because the game is about scaling
It’s weird yes but nessesary so you arnt super fast or slow
Alright but it's also extra weird because you're doing this:
orientation.TransformVector(moveVector)```
basically you have an issue here in that you're mixing frames of reference
that velocity code is in world space
so it isn't properly accounting for which direction the player is facing
Ah
Wait what does that have to do with W and S not doing anything and A and D moving me very fast?
Previously in the code when W and S worked they moved me at normal speed
While A and D still moved me quickly
well it might be that your scale is preventing you from moving in those direcitons.
But really the answer to these questions starts with debugging
start by adding Debug.Log statements to your code
you'll want to print out what input values you're getting to start with
then keep printing things until you see something unexpected
that will be where your bug is
also, in a game like this it's probably better not to directly use the Transform scale as the source of truth. A custom component with a ScaleFactor property on it as the source of truth to manage all the scaling stuff would be more extensible and easier to work with.
Why is the transform scale untrustworthy?
It's not so much untrustworthy it's just poor code architecture.
- Any script can change it at any time, including things that are maybe just supposed to be visual and not affect anything else
- Using a custom property would let you control what else changes when you change the scale. For example when the scale changes you might also want to change some camera settings, change the player's health, modify a postprocssing effect, play a sound, do an animation, whatever, right? If you use a centralized property that will guarantee all those things always happen when the scale changes. It makes it so you can't forget anything by accident.
- It also has benefits for serialization and game state management. You can't serialize a Transform,
mmm i see what you mean but in the game the only objects who's scale will change effects are interactable objects like boxes and the player with the only thing effecting scale being the tunnel that changes the scale of the object with a script that tells it to do so
this method also lets me personally change the scale of objects in editor and see the scale change still in editor
That sounds like even more of a reason to use a special component for it
this can be done with OnValidate
anyway I'll drop it, just my recommendation
let me know if you need help debugging the original issue
yeah i will. ive had a few years of experience in Unity level design and light c++ experience but im trying my hardest to try and get better at the c++ half and this movement system is giving me a lot of pain so far
i think my issue is coming from link 83
Vector3 velocity = rb.linearVelocity;
stuff works before then but not after, velocity isnt being set to anything when W and S are pressed
Have you done any debugging there
You should print out what moveDir, moveSpeed, and velocity are at that point
as well as what the scale is
ah the issue seems to be W and S is moving me up but gravity keeps me down so nothing happens
shouldn't w and s be forward/backward?
not up/down?
Yeah you're not swizzling your input vector to x/z
you're leaving it as x/y
i got my movment system fully working now thanks! i will probably need to worry about things like coyote time and buffering inputs later tho but for now it works
so I take it if you put playerControls.Player.Enable(); this it'll enable all of the commands within these actions within said Actionmap
on the map called player
you would have the same for the UI map, correct?
There's no special handling for differently named action maps. Though I generally recommend against having a custom UI input map unless there's a really compelling reason not to use the default one.
Im trying to have my interact prompt be used to grab a box but for when i press E it counts as multiple press so i repeatedly pick up and drop it. Is there a way to only count unique instances of pressing E?
Many ways. The appropriate way depends on how you're currently handling input
How do you reffrence a jump input within an if statement with the new input system?
In Update?
You do:
if (myJumpAction.WasPressedThisFrame())```
If you're using events it's different
public void Interact(InputAction.CallbackContext context)
{
Debug.Log("pressedE");
if (item == null)
{
Debug.Log("grabbed");
pressed = true;
OnGrab();
}
else
{
Debug.Log("relesed");
pressed = false;
OnRelese();
}
}
thats my current code
I think I'm starting to get into the Advanced stuff, I know how to do the old input system, but want to get into the new input system, followed a tutorial, doesn't say much as in how you do things
You have to do if (context.performed)
There are many ways to do any given thing in the new system. It all depends on the workflow you're using
never understood workflow since I never worked for someone whilst coding etc
I'm ujsing workflow in the plain meaning of the word here. Nothing to do with programming
I still don't even know what workflow even means
The new input system has several different workflows you can use to handle input:
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/manual/Workflows.html
it means a way of doing things
if its like this, it dosent seem to be working
public void Interact(InputAction.CallbackContext context)
{
if (context.performed)
{
Debug.Log("Pressed E");
if (item == null)
{
Debug.Log("grabbed");
pressed = true;
OnGrab();
}
else
{
Debug.Log("relesed");
pressed = false;
OnRelese();
}
}
}
not working how
when i press E nothing happens
You can add:
Debug.Log($"Input phase is {context.phase}");``` to the top of the method to see what's going on
is there a tutorial explaining how to use the new input system well using reffrences like if statements etc?
Since Documentation isn't adhd friendly lol
with 1 E press
if statements are something you should already know how to use before using the new input system.
oh it works if i press and hold
sounds like you added a Hold interaction to your action
was that on purpose?
Sounds like it wasn't
it was not
you should remove all interactions from it
this is my list rn
since Originally I had the old input system to do that
that's not relevant to what I was mentioning
you need to open the actions asset
oh i see what you mean ok fixed
and look at the Interact action
{
isPointerOverUI = EventSystem.current.IsPointerOverGameObject();
}```
This won't work on mobile right?
Since with an empty parameter it will only work with mouse
Or am I missing something?
just try it out and find out
Lol, thx 😭
How do you hook your input action asset up to your game code?
One possibility I'm imagining:
- At the beginning of the scene you are making a copy of the InputActionAsset and using that - therefore the copy doesn't pick up the changes made to the original.
if you're using the PlayerInput component, I believe that component makes a copy by default.
uhh i just do this
Right - you're using the PlayerInput component
that explains it, as per what I said above about the copy
how do i update the copy?
you can access the copy from the PlayerInput component
myPlayerInput.actions
One option is to copy all the overrides from the original to the copy with:
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.5/api/UnityEngine.InputSystem.InputActionRebindingExtensions.html#UnityEngine_InputSystem_InputActionRebindingExtensions_SaveBindingOverridesAsJson_UnityEngine_InputSystem_IInputActionCollection2_
and
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.5/api/UnityEngine.InputSystem.InputActionRebindingExtensions.html#UnityEngine_InputSystem_InputActionRebindingExtensions_LoadBindingOverridesFromJson_UnityEngine_InputSystem_IInputActionCollection2_System_String_System_Boolean_
this is a virtual joystick, it can read value and move characters, however, i want to make it more flexible
i only missed one step to finish it, i want to change its position and start reading value once the player tap onto the area below, it must ignore all other taps if its outside of the area or if the tap was on certain UI
my question is , how can i trigger these two things when i tap onto the area , with sequence
- change the position of the joystick
- do whatever the joystick used to do
its using onscreenstick btw
- Use a transparent UI image below the stick to detect OnPointerDown and move the stick there ane show the stick
- Should come for free
i got 2 finished dw , i just cant execute both action at same time
so i made an image below the stick , somehow it needs to be as children of stick to work?
but if it became children, it wont limit the position right? as it moves along with the joystick (the green area will move together)
i guess manually reset it should be fine
how will u deal with input noise when u swiping ur smartphone for controls like "looking"
i can pickup values and move my camera, but maybe because my fingers are too big , when i swipe left, the value i picked up had vertical input noise, and it is way too significant i cant even suppress it
public class Look : OnScreenControl, IPointerDownHandler, IPointerUpHandler , IDragHandler
{
[InputControl(layout = "RJoystick"),SerializeField] private string m_ControlPath;
protected override string controlPathInternal
{
get => m_ControlPath;
set => m_ControlPath = value;
}
public void OnPointerDown(PointerEventData data) => SendValueToControl(data.delta);
public void OnDrag(PointerEventData data) => SendValueToControl(data.delta);
public void OnPointerUp(PointerEventData data) => SendValueToControl(data.delta);
}```
i think i will try to make a input dead zone first
How do I make it.ao something happens when I hold a key down for a specific amount of time for example like 5 secs
make an action with the Hold modifier and listen for its performed event
Oh ty I'll try that
I'm getting stuck up on Ui buttons. Currently when i click on them nohting happens.
my button looks like this
Make sure that:
- its canvas includes a
GraphicRaycaster - none of the
CanvasGroupcomponents in parents haveInteractabletoggled off - there is
EventSystemin the scene - no other interactable UI object with
RaycastTargettoggled on is covering your button (e.g., transparent objects or text)
Ah I have no graphic ray cast I’ll be sure to try that tomorrow
tried this didnt work also i dont think its issue with another inputasset being used the instance id of the inputactionasset never changes its always 780
also even when inputActionAsset.Disable(); it doesnt seem to be doing anything
isnt it supposed to stop the inputactionasset from functioning
im using only one inputactionasset
where and how are you logging or checking that?
All of the symptoms you are describing match the idea that there's an asset copy, which PlayerInput certainly is known to create
nvm i was just getting the id of the inputasset allocated in inspector
the save seems to be working and when i load the saved bindings on awake it still doesnt take effect until after i reload the scene
the ui is updated on awake tho
Oh absolutely not yeah
Didn't know you had
huh? i have several PlayerInputs on separate objects just fine
or is there more specific context here?
Are you doing local multiplayer?
that's the only way that generally makes sense
PlayerInput grabs an exclusive hold on the devices they claim.
It's designed as 1 PlayerInput == 1 human player
im not, im doing it all singleplayer
i wasn't super familiar with the other methods when i started the project, so i used playerinput wherever i needed to receive input
i have one on the player for player control and one on the game manager for controlling overlay menus
they're using separate action maps though
though the same default input action asset, so not sure that matters
Why is there hardly any information regarding thew new input system in the documentation?
There's tons. Are you looking in the right place?
If I want to find this Mouse.current.position.x.GetValue() and other related comands where do I go?
Or the scripting reference https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/api/index.html
Ah, I see, thanks
I was refering to the regular documentation
https://docs.unity3d.com/6000.1/Documentation/Manual/Input.html
There's almost nothing there
Don't know why
This page links to the page I sent you
Most package documentation lives in the unity3d.com/Packages/package.name.here domain
someone got some time to help with a small conversion from old input system to new one, it's very basic tho
You need to just share the details of your issue
Nobody is going to commit to helping you ahead of time.
again, https://dontasktoask.com
i linked you this 30 minutes ago
if you had just asked then you probably wouldve already gotten an answer lol
I didn't see it probably because I'm pulling hair out with this basic stuff (I'm new to Unity) but yeah my bad
so I've been trying to migrate from the old input system to the new one, been following a tutorial for a 2D arcade style car racing game but it's using the old system
do I just put a piece of code in here?
share all relevant information, including code and a description of your issue.
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
For me it links to the normal Unity Docs everyone knows
There a link within that page to the input system package docs
Hi, I recently upgraded my project from Unity 2022 to 6.1 and noticed some input action changes. Previously, Enter used to submit for input fields, but now I have to do Ctrl+Enter. However, the Unity input actions asset still show the UI Submit action as just Enter. Is there some other place that is controlling this behavior now?
Nothing should have changed there
you definitely shouldn't need ctrl+enter
it would be configured in the input action asset assigned to your input module, which is typically the default asset
it's unusual to change that
Any idea what might be going wrong? I've never touched the input action asset in regards to the Submit action, and its derived bindings still show "Keyboard > enter"...
Whenever I press Enter, it selects all of the text as if I'm focusing on the text field.
Do you have sticky keys on or something?
or a cat resting on a key
or any stray devices plugged in
Not that I know of. My teammates are also experiencing the same thing on their end 😅
Our old build in Unity 2022 still behaves normally, so we figured something changed when updating to Unity 6.1
i had one attached to the ui element for opening and closing the menu ig ill just put it into the movement map and do it from there
how can i check the last one? and do i need to do anything with the event system?
The EventSystem is just necessary for UI to work. Default settings should work fine.
For checking out the currently hovered object, you can create a script containing the following code:
void Update()
{
PointerEventData pointerData = new PointerEventData(EventSystem.current)
{
//position = Input.mousePosition // if you're using old input system
position = Mouse.current.position.ReadValue() // if you're using new input system
};
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointerData, results);
if (results.Count > 0)
Debug.Log("Hovering over: " + results[0].gameObject.name, gameObject);
}
mmm its not printing anything
Guys, I have a game with a ready-made set of input elements, and everything works fine.
However, when I switch to the new input system package, I encounter errors.
My question is, for a multiplayer game or even a single-player game, which input system is better to use? The old one or the new one?
those are just errors that occur when you switch from an old system to a new one
So why was that included in the question 🤔🤔
Why is Unity's default button behavior to leave a button in the "selected/pressed" state after my mouse has left the button?
Selected, yes.
Pressed, no.
Clicking on any selectable selects it.
so it being selected sets it as "highlighted" is there a way to have it not be selected when mouse exits the button?
I tried calling EventSystem.current.SetSelectedGameObject(obj); in my onpointerexit and no joy
I set the selected sprite to normal sprite (doing sprite swap instead of color tint) and it exhibits the same behavior
the edge case is press on button and drag mouse off of button while keeping the left mouse button held down
the button appears lit up, the desired is that the button stops being lit as soon as the mouse button has exited, regardless of the mouse being held down
the OnPointerExit approach should work fine
i would recommend the new one, once you know how it works, or how event works, u will find new input system are easier to implement, tho old input system is easier to setup if u only have very simple inputs
plus the new one has a lot of extra components that helps simulate those classic inputs u found in smartphone games
Hey, I am working with Unity 6.3 and inputs just seem messed up in the build, is this a bug or am I doing something incorrectly?
I have the Input/Asset as shown in the 1st image.
It's set as the default thing in the project settings, as send in the 2nd image.
I have inspector references to these actions in my rebinds, as seen in the 3rd image.
They work fine as seen in the editor and logs(intentionally error logs), picture 4.
Lastly, they are null(editor log) in the build and rebinds obviously don't work, as seen in the pictures 5 and 6.
I have a feeling this is due to unity not handling the default input asset correctly or something but I am not 100% sure, that wouldn't explain inspector references missing at all.
Please @ me and thanks in advance!
oh, forgot to mention that I am using the latest version of the input system
it might help to show us this Assets.Scripts.Rebind.RebindSaveLoad script
It's the one provided by the Unity docs, unless I've mistaken it for something else.
Here tho:
https://gitlab.com/nnstdios/katana/-/tree/master/Katana/Assets/Scripts/Rebind?ref_type=heads
btw, I don't htink it's that script really
my in game inputs don't work either and I am getting them in a similar way
I first activate the main map in the game manager:
https://gitlab.com/nnstdios/katana/-/blob/master/Katana/Assets/Scripts/Core/GameManager.cs?ref_type=heads#L60
And then I use those binds:
- Init inputs in
OnEnable: https://gitlab.com/nnstdios/katana/-/blob/master/Katana/Assets/Scripts/Player/PlayerScript.cs?ref_type=heads#L144 - Uninit
OnDisable: https://gitlab.com/nnstdios/katana/-/blob/master/Katana/Assets/Scripts/Player/PlayerScript.cs?ref_type=heads#L159
Do let me know if I am doing something wrong.
btw, in case you are planning to clone the repo, make sure you use --recurse, and also, build times take at least 1-2h the first time you do it, unity is great at shader compilation
I also found this, but as the person stated, they never found the solution:
https://discussions.unity.com/t/project-wide-actions-1-8-0-pre-2-release-feedback-wanted-new-update-released/928455/39
Here's a forum post too, might be better to answer there so it stays for everyone who runs into it:
https://discussions.unity.com/t/input-system-works-in-editor-but-not-build/1677952
I have an issue with the play mode and pointer press event.
When I enter play mode, the game view does not register pointer events until I click in the view. But when I do click the game view, it triggers the press callback which I don't want happening.
how do I clone action maps for multiple players?
The simplest way is to use PlayerInputManager/PlayerInput
glad there's an input channel but I'm wanting to use the dpad as buttons in the old input manager but I'm running into a wall with the vertical slots. got the horizontal working through some trial and error but for the life of me I can't figure out the up and down
I initially went through the inputs trying to find a combination that let me move the up and down but now I just have it set to what I had the horizontal buttons set to out of convenience. here's the code and input manager
well you've set it to the same joystick axis but on Joystick 2
so you'd have to have a second joystick/controller plugged in and to use those same buttons there for that to work
For most controllers (e.g. standard xbox and playstation controllers) it should be Axis 6 for dpad left/right and axis 7 for up/down
saw that as a solution on google and chatgpt but for some reason that doesn't work either. not sure if it's because my controller's drifting or what but 6 on the horizontal and 7 on the vertical didn't work for me
wired or bluetooth
wired in both cases
ok yes, try your xbone with both set to Joystick 1 and try the 6 and 7 axis.
Also actually debug what you're seing. E.g.:
Vector2 inputVector = new(Input.GetAxis("DPAD Horizontal"), Input.GetAxis("DPAD Vertical"));
Debug.Log($"Input vector is {inputVector});```
yeah ig it was just the ps5 controller bc the xbox controller works perfectly
weird. thanks Praetor
Supporting multiple gamepads with the old input system is near-impossible. Highly recommend switching to the new one, where Xbox and PS controllers will work out of the box.
No I did not see the date that was posted 🙃
Yeah it looks alot easier but my pc can't support another update at the time but when I get a proper pc I'll make the switch
the path you've set as the code editor is missing, go reconfigure it
if you need further help, ask in #💻┃unity-talk, as this isn't an input system issue
Hello everyone 🙂
I've joined this server to share the following forum post I made, regarding a possible bug with the merging of pointer input events in version 1.14.2 of the new input system: https://discussions.unity.com/t/possible-bug-with-pointer-position-press-input-events/1680450
Any insight any of y'all might have would be highly appreciated
Have you submitted a bug report from within Unity's bug reporter tool? That's the best way to get their attention.
Design question, how do you usually access input actions in your project? One big singleton with input actions referenced?
Depends on the project.
A singleton managing a single instance of the generated C# class is a pretty good starting point for most projects with a single player on the device.
For local ultiplayer always PlayerInput/PlayerInputManager
ok thx
Thanks! I haven't heard about PlayerInput up until now, sounds great for local multiplayer 😮
that's usually the first way people learn to use the input system
I poll actions in an update loop, not using a single bit of PlayerInput component for now
Might be bad practice though I don't know 😄
Yeah that's fine it's just most tutorials focus on PlayerInput so that's how most people learn it
I tend to prefer handling stuff myself rather than through built-in components
It's mainly because of my lack of knowledge of the new input manager package I guess
Another question, how do you usually handle the pass-through click event when you interact with UI?
I'm using the EventSystem.current.IsPointerOverGameObject() but I don't like it, I'm sure there might be a better way 😄
I use the event system for all of that stuff
then you get the behavior for free
for example - let's say you have a top down game where you can click somewhere in the game world to have your character walk there.
It's tempting to make an input action for the click, and then in Update you look for that click and do your own raycast etc.
This would be the wrong approach. The better approach is to give the ground object an IPointerClickHandler script and handle the clicking there
then you get the "ui blocks this" behavior for free
work with the event system, not around it
Ah that sounds great indeed!!
I'll look into that rather than direct calls to its API
just note for that to work you need an EventSystem in the scene and a Physics Raycaster on the camera
Sure, thanks!
No, I'll go ahead and do that
anyone know what's up with this? only in unity, multiple editor versions, fresh projects with new input system, nothing but keyboard and mouse plugged in.
Windows/other tools don't see any gamepads/inputs at all
this has been a problem for multiple years and it's entirely prevented me from using the new input system
What is the code that produced this? How is the action set up? We need more context
With the new input system, can you integrate it with a Nav Mesh?
If so is there a guide to do it that isn't too complicated
those are two completely unrelated systems
any integration would be custom-made by you
What does that mean exactly?
Combine basically
Can you write a full sentence explaining what you are trying to accomplish with the input system and NavMesh?
I'm currently doing a project, instead of using a mouse click, I want to convert the inputs to the new input system for more functionality with supported gamepad etc that behaves similer to the mouse click, but this is for a toush screen behaviour aswel
what does that have to do with navmesh
Hey, I'm using the new input system.
private void OnMove(InputValue value)
{
Vector2 rawMovementInput = value.Get<Vector2>();
_movementInput = rawMovementInput.magnitude < _deadZone ? Vector2.zero : rawMovementInput;
}
I have a function like this, and if I understand correctly it is triggered by PlayerInput using SendMessage?
How can I do something like this for a button? I have a sprint button which basically is a Left Stick Press. I want to detect when it is held and when not
okay, I did something like this and it works,
private bool _isSprinting = false;
private void OnSprint(InputValue value)
{
_isSprinting = value.isPressed;
if (_isSprinting)
{
Debug.Log("Started sprinting");
}
else
{
Debug.Log("Stopped sprinting");
}
}
not sure if this is the correct approach?
this is a pretty typical approach, yeah
alright, thanks
bit of a weird issue, two actions I have share a button, but only one goes through. any reason for this?
okay, i have no idea why but putting turn on top of sprint seemed to fix it
I'm having issues with the Netcode multiplayer just.. not taking input? the host uses the action map perfectly fine and everything works well on it, but whenever i connect the client, NOTHING is received (on the client side, the host works just fine). I've tried everything, making multiple action maps, all that, but I just can't figure it out
I really really need help with this :|
Turns out the issue was the action map was becoming a non existent "clone"? idk
Is there some way to make the InputSystemUIInputModule ignore the regular mouse?
When we use gamepad we hide the mouse and use a different control scheme, but if an element moves under the mouse it ends up hovering it
Setting "point" to none on it makes it not use the mouse, but that doesn't seem to work at runtime, and probably would also disable the virtual mouse.
Looks like VirtualMouseInput does InputSystem.DisableDevice, so maybe that's the move
I’ve worked with Unity Netcode + the new Input System before, and that “cloned” action map issue usually comes from how the input is being instantiated or bound on clients. I can help you debug and set up the input handling so both host and clients register actions properly. Are you currently enabling the action map in a PlayerInput component or through script on the client side? @mental sedge
Currently in a PlayerInput component which is on multiple player prefabs
Essentially there's multiple classes in my game, therefor multiple player prefabs
It's kind of problematic to have PlayerInput directly on the player prefab in a networked game.
- PlayerInput is a "there should only be one of these in the game per physial human player on this device" component
- When you do a networked game you're typically spawning one copy of the player prefab per connected player.
- therefore you're getting multiple PlayerInput components in the scene.
Each time a PlayerInput is spawned it looks for an eligible set of devices (per your control schemes) on the local machine and claims them for its own exclusive use. So essentially what may be happening here is you're getting secondary PlayerInput components for non local players, which messes with your ability to control the local player.
Does that sound about right?
Also if you are spawning more than one of your player objects for a single player, that is a further issue when using PlayerInput.
Yeah that's mainly the issue
it's weird cause I thought I found a fix, which was just reassigning the input to be the player action map instead of the clone, which worked, then i went to dinner and it stopped working
so what do you think I should do
For multiple players
Do you need to support local multiplayer in this game at all?
Or only networked multiplayer
Only networked cause I'm just planning on giving this to my friends, maybe something with itch.io but mainly just networked with me and my friends
Then the simplest thing to do is to stop using the PlayerInput component, which is really designed for local multiplayer.
oh, I thought it was a needed component to have input go through
If not a playerinput component then how do I receive input?
i think i made a list here once, one sec
that isn't even everything
there's also hardware device polling
and probably more that im forgetting
yeah
i mean which would you recommend for networked multiplayer
I'd recommend using the generated C# wrapper class
The other alternative here is to keep using PlayerInput but don't put it on the player prefab itself
you'd need some glue code to get it to control the instantiated player object then though.
wrapper?
sorry I'm very new to all of this
thank you so much for the help
The Image has a width of 100 and the Input Text has a width of 100... Why are they not aligned at the end?
wrong channel, #📲┃ui-ux and provide some more info
Hello !
I'm facing some difficulty with the new input system and cinemachine
I'm implementing the "new" input system in my game with a generated C# class.
However, when I tried making a pause menu, I noticed that my Cinemachine camera didn't listen to the deactivation of the Action Map (Disable() ), my camera is still receiving input
I changed the default X and Y Look Orbit axis by my custom action axis in the cinemachine input axis controller
I tried unchecking the box "Auto Enable Inputs" in the cinemachine input axis controller which did the opposite effect where the orbit input didn't received any input at all even by manually enabling my action map
Is this a known problem or did I missed something while setting things up ?
I'm using Unity 6000.0.45f1 with the new input system 1.14.0 and cinemachine 3.1.4
Your Cinemachine camera is using a different instance of the actions asset than the one you're disabling
When you do new MyGeneratedClass() you're creating a brand new instance
Thanks for answering
How am I supposed to interact with cinemachine then ?
Is there a way to access the instance used by cinemachine , or to force the use of an instance I manually set up ?
anyone know what's up with these errors? the game still works normally, at least on the editor
i have a debugger connected and nothing's showing up
it does apparently make it so a certain event isnt registered when playing on a build
im also getting those errors while on the editor OUTSIDE of play mode
for example, typing something into the asset search bar
Now I'm trying to update the package but it says it's up to date with 1.2.0
Changing it in the package-lock.json does nothing as Unity automatically reverts it back to 1.2.0
But up to 1.12.0 should be compatible with my Unity version (2021.2)
Might've solved this by updating from Unity 2021.2 to 2021.3 (and/or updating the Input System package. If you have the problem where only up to version 1.2.0 is available, you can update to newer versions by clicking the "Add version X.X.X by name" link in the Changelog entries: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.12/changelog/CHANGELOG.html)
For further reference so people can search for the error: Event must be a StateEvent or DeltaStateEvent but is a TEXT instead Parameter name: eventPtr
I desperately need help with using an HID device having a lot of strange input artifacts that I don't even know how to describe. If I can't fix this, my game is scrapped. Anyone is welcomed and encouraged to DM me to try to help, I have tried everything I can think of. My issue involves a HOTAS, so if you have any experience with that, even better. Please help
we don't really do DM support here
you'll probably have to provide more info here
I'm adding mobile touch screen controls to my game, and have some problems.
The regular joypad sends like vector(1,0) when I press right, and when I eventually release it sends (0,0).
The digital joystick just seem to send values as long as I'm dragging my finger on the screen, while I wish it would behave like a d-pad/joystick. Is this an easy setting, or do I need to code it myself?
What's your actual goal?
Input actions will typically send new data whenever there's a new actuation value, so it sounds correct.
Alternative question: why is this an issue for your game and what are you trying to achieve with the controls?
Well, my game works great with gamepad or keyboard. I press and hold <right> on gamepad or D on keyboard and the character keeps moving to the right, until I release the trigger.
I would like it when I press the screen and drag a bit to the right and hold, that it would act the same way ...
But instead the screen control sends (1,0) when I'm dragging my thumb, but as soon as i stop dragging and just hold it, it sends (0,0) instead.
You see, it's acting like a mouse rather than a joystick
hi, i'm wondering what happened with this issue:
calling Gamepad.SetMotorSpeeds can be extremely slow over bluetooth. I found 3 threads on the subject but no response from unity.
what should I do? Should I just not use this method if the gamepad is wireless for now?
here are the threads:
https://discussions.unity.com/t/inputsystem-rumble-should-not-be-used-with-bluetooth-controllers/855000
https://discussions.unity.com/t/gamepad-setmotorspeeds-is-very-slow/938302/2
https://discussions.unity.com/t/gamepad-setmotorspeeds-cpu-usage-is-very-high-with-bluetooth-controllers/853942/7
is there a way to know if the controller is connected via USB or bluetooth? I can't find any way to detect that
I need some help with controller and input system. I want to move the ship in my game with d-pad. I've tried adding "D-Pad [Gamepad]" it didn't work. I've then tried "Hatswitch [Any]" it also didn't work. And only when adding "Hatswitch [Lic Pro Controller]", which is the specific input for my controller, it did work.
I thought that "Hatswitch [Any]" would cover, as the name say, any hatswitch controller. Is that NOT the case?
I'm afraid that I'll have to add all the different variants of controller in existence for it to work for all players. It doesn't sound like a good approach. Help!
Input system does not provide abstractions for specific joysticks, if the device you have doesn’t map correctly to PS/Switch/xbox/steamdeck mappings the [Gamepad] path will fail.
Also make sure your input scheme doesn’t require additional devices to be present. Schemes only activate when all required devices are present.
I have figured out the basics like how I can change the sprite of an instance on click, but I have no idea how I can do more complex stuff like detecting a drag click and broadcasting the destination when the LMB is released.
I have no idea what extra information you'd need to assist, but I've been struggling with using this menu for half an hour now
So what is your recommendation? Adding as many as possible? Is there a go to list of controllers?
And thank you for the answer!
All of what you mentioned should be handled through the UI event system, not the input system directly:
https://docs.unity3d.com/Packages/com.unity.ugui@3.0/manual/SupportedEvents.html
idk if there is value in your game supporting weird hardware. most titles would either support only the generic/canonical first party inputs and skip third party devices entirely. Games that make an effort to support third party devices (flight & driving sims) use Rewired (asset) which comes with support for many third party devices, particularly wheels and joysticks.
thank you!
iirc rewired is just a layer on top of input system nowadays
Hello il have a problem with the input system, i create a game for Android, in the editor, all of the buttons works but on my Phone it's does not work
Hi all, I'm currently working on a game that will utilize RC Remotes with USB functionality to control an FPV Drone in game. The issue I'm having is that there is no universal standard for how these radios report to the host and what their controls are. Is there a way to get the latest input event from an axis of the joystick connected to let the user rebind it themselves?
The last part of your question is to use a passthrough action
As for the USB radio protocol etc, you'll probably need to make a custom input device
Thanks for getting my attention to passthrough actions. As for the Radio, it's not like they use some proprietary driver. They report as regular HID Joysticks in Windows, however the issue is that how they expose their controls isn't standard. Some have the right stick as an actual stick input and put the left stick on two separate axes, some do the opposite and some others do a mix of what input maps to the stick.
I think it would be best if I listened to what input device has a changing value / axis and then use that as my input action. Is there a way to get the latest moved / pressed input?
Sounds like you just want to let the user rebind the axis
Do someone know that why character is moving diagonally when I hold movement keys and also player is moving opposite, W = backward, S = Forward, A = Right and D = Left?:
probably because something's set up incorrectly
you didn't really give any info whatsoever to work with lmao
Oh sorry I forgot to send codes
debug your values. see if it's the input that's wrong or the mesh direction or something else
using TMPro;
using UnityEngine;
public class PlayerControls : MonoBehaviour
{
public Rigidbody character;
private Animator characterAnims;
private PlayerInputs inputActions;
private Vector2 characterMovement;
public float characterMovementSpeed = 1.5f;
public TMP_Text movementKeyDebug;
void Start()
{
character = GetComponent<Rigidbody>();
characterAnims = GetComponent<Animator>();
inputActions = new PlayerInputs();
inputActions.Player.Enable();
}
void FixedUpdate()
{
characterMovement = inputActions.Player.Move.ReadValue<Vector2>();
if(characterMovement == Vector2.zero) movementKeyDebug.text = "";
else if(characterMovement.y > 0) movementKeyDebug.text = "W";
else if(characterMovement.y < 0) movementKeyDebug.text = "S";
else if(characterMovement.x < 0) movementKeyDebug.text = "A";
else if(characterMovement.x > 0) movementKeyDebug.text = "D";
if(characterMovement != Vector2.zero)
{
Vector3 move = new Vector3(characterMovement.x, 0f, characterMovement.y);
character.MovePosition(character.position + move * characterMovementSpeed * Time.fixedDeltaTime);
characterAnims.SetBool("isWalking", true);
}
else characterAnims.SetBool("isWalking", false);
}
}
your character probably just isn't aligned with the world axes if i had to guess
this still isn't much info
you need to go debug yourself
Ok
I have a windows Unity app. I want to port it to be a mobile app. I need controls for wasd and some more buttons. What is the fastest way to get there? Which packages are helpful there?
A game designed for WASD + even more buttons is not gonna translate well to mobile. Regardless, you may want to look at fingers (asset) https://assetstore.unity.com/packages/tools/input-management/fingers-touch-gestures-for-unity-41076
How so? Wasd is not difficult on mobile, is it?
think a bit about what 'touch' input really means and whether your game remains truly fun to play when people have to press & hold a bunch of on-screen buttons just to move around. Mobile works best when the input the game needs is designed around finger-gestures and tap-interactions (not press-hold or hover-click)
The fastest way is to use On Screen Controls from the new input system. (E.g. On Screen Stick/Button)
That doesn't mean it's a good idea, but that's the fastest way.
You mean this?
In this third video in our tutorial series, we’ll show you how to add mobile touch controls to your game using Unity’s Input System.
You’ll learn how to use the On-Screen Stick and On-Screen Button components to set up on-screen controls for mobile devices, enabling touch-based input for third-person character movement.
More resources:
...
Yes that tutorial uses on screen controls
How can i get an asset inputassetcollection? theyre not available in the inspector, and in my context i dont have a PlayerInput instance that you can read from. I want to be able to remove all binding overrides
never mind figured it out
I have a very weird bug. 2 separate friends (one windows 10, one windows 11) both cant move in my game, but they CAN press other interactable buttons in the game used by the inputsystem such as opeinng the map.
Even weirder one of them has an old build of the game they previously could move perfectly fine on months ago but when they now load it up they can't move anymore.
On my computer, all works perfectly fine.
private void OnMove(InputValue movementValue)
{
Debug.Log("Attempting to move " + isLocked + " loading: " + GameManager.isGameLoading);
if (!isLocked && !GameManager.isGameLoading)
{
_movementInput = movementValue.Get<Vector2>();
Debug.Log("Moving " + _movementInput);
}
else if (_animator.GetBool("isSleeping") || _animator.GetBool("isSitting"))
{
_animator.SetBool("isSleeping", false);
_animator.SetBool("isSitting", false);
isLocked = false;
}
}
My movement code, although im not doing anything special.
And the player controller
My guess is you have more than one PlayerInput component in your scene
this will cause pretty much the exact symptoms you're describing
Also the thing you called "the player controller" is an Input Actions Asset
i dont
if it makes a difference both also have unity installed but idk why or how that would have any effect. im just bewildered about the old build suddenly breaking
Well, you haven't really provided enough info here to debug
what info should i get to debug? im not even sure if it is the input system or my code or my game at all because of previous untouched builds becoming unstable
Hence why you need to debug.
Add logs for when you receive input, for example.
for anyone else wondering how to fix this code fixed it for me (run it on start)
private IEnumerator Check()
{
Debug.LogError("console is free");
Debug.Log("Starting check, waiting 5 seconds...");
// Wait for 5 seconds
yield return new WaitForSeconds(5f);
PlayerInput playerInput = GetComponent<PlayerInput>();
Debug.Log("CHECKING PLAYER INPUT AFTER 5 SECONDS");
while (!playerInput.user.valid)
{
Debug.Log("Waiting for PlayerInput user to become valid...");
yield return null; // wait
}
if (playerInput != null)
{
Debug.Log("PLAYER INPUT NOT NULL");
// control scheme switch
playerInput.SwitchCurrentControlScheme(
"Keyboard&Mouse",
Keyboard.current,
Mouse.current
);
Debug.Log("Switched control scheme to Keyboard&Mouse");
if (playerInput.currentActionMap != null)
{
Debug.Log("Current action map: " + playerInput.currentActionMap.name);
}
}
}```
+ disabling gamepad from the input actions asset
I'll mull this over tomorrow and properly implement the fix. very weird nonetheless!
Yeah this is related to control schemes.
If your game is not local multiplayer, yous hould get rid of all control schemes
you can still freely add bindings from different devices to your actions
but PlayerInput uses control schemes to assign devices to players
I'm having some problems with input system:
- I click a button (Enter) to enter the game and switch ActionMap to "Game"
- The first thing that happens when entering the game, is that the "Game" actionmap sees that Enter is pressed, and acts on that event.
This happens even if I use context.canceled to trigger the switching of actionmap.
Should I clear some buffer or cache or something? Ideas?
most people use a coroutine to switch the action map on the next frame as a workaround
This happens even if I use context.canceled to trigger the switching of actionmap.
Though this is odd and implies to me you're not checking the action phase for your in-game input handling
I would expect to see a canceled but not a performed most likely
So I'm pretty new to UI in general, but I've been working on trying to implement UI Toolkit (UXML files) with the Input System.
I really like UI that is controlled with WASD/gamepad rather than mouse clicks, and I've been trying to use Input system with UI Toolkit, but it's super unintuitive... (I mention this specifically, because every single Toolkit tutorial I've seen uses the same exact example of clicking a button on the screen)
Does anyone have any workflows they do when trying to make interactive UI with Toolkit that doesn't involve mouse click buttons?
Checking the action phase?
I'm mostly using context.performed to trigger events, but I guess this is not what you're talking about?
I don't know why but sometimes characterRunning value becomes 0 randomly while running causing character to do walk animation for a moment while running even though I don't stop holding space bar?:
//In FixedUpdate():
Vector2 characterWalking = inputActions.Player.Move.ReadValue<Vector2>();
inputActions.Player.Run.performed += ctx => characterRunning = 1;
inputActions.Player.Run.canceled += ctx => characterRunning = 0;
if(characterWalking != Vector2.zero)
{
Vector3 camForward = Camera.main.transform.forward;
Vector3 camRight = Camera.main.transform.right;
camForward.y = 0f;
camRight.y = 0f;
camForward.Normalize();
camRight.Normalize();
Vector3 moveDir = camForward * characterWalking.y + camRight * characterWalking.x;
Debug.Log("characterRunning value is : " + characterRunning);
if(characterRunning > 0)
{
character.MovePosition(character.position + moveDir * characterRunSpeed * Time.deltaTime);
if(moveDir != Vector3.zero)
{
Quaternion targetRotation = Quaternion.LookRotation(moveDir);
character.MoveRotation(Quaternion.Slerp(character.rotation, targetRotation, 0.15f));
playerCamera.transform.position = character.position + playerCamPos;
}
characterAnims.SetBool("isRunning", true);
}
else if(characterRunning <= 0)
{
character.MovePosition(character.position + moveDir * characterWalkSpeed * Time.deltaTime);
if(moveDir != Vector3.zero)
{
Quaternion targetRotation = Quaternion.LookRotation(moveDir);
character.MoveRotation(Quaternion.Slerp(character.rotation, targetRotation, 0.15f));
playerCamera.transform.position = character.position + playerCamPos;
}
characterAnims.SetBool("isWalking", true);
characterAnims.SetBool("isRunning", false);
}
}
else
{
characterAnims.SetBool("isWalking", false);
}
inputActions.Player.Run.performed += ctx => characterRunning = 1;
inputActions.Player.Run.canceled += ctx => characterRunning = 0;
you're doing this in fixedupdate?
Yes
that should not be in fixedupdate
that should be done once on initialzation, so either in awake or start
I has tried this in Start but still sometimes its value becomes 0 randomly
This is how I have used Run in Player input file:
well you have the same issue now so sounds like it's not fixing the issue lol
it should absolutely not be in FixedUpdate
have you tried the input debugger to see if space is being released randomly? could be a hardware issue
I have tested my space bar key in Key Test website
And it was working fine there
Wait let me check again
Maybe this could be keyboard problem
Because this is showing space bar 3 times after left click but I hasn't stop holding space:
have you tried with different keyboards, if you have them?
No, I am going to test it using mouse by creating a UI button for running
ah yeah that also works
Yes, it worked fine with UI Run button
rather thajn subscribing to events why don't you just do:
characterRunning = inputAction.Player.Run.ReadValue<float>();``` as needed?
Or better yet:
```cs
bool isRunning = inputAction.Player.Run.ReadValueAsButton();```
For the love of God can anyone help me with this?
I am making a custom virtual joystick, that outputs the vectors basic stuff.
And my game is using full on input system for it.
Like input action for Move and look, and some buttons.
Since i am using Unity UI Tookit for the custom Joystick for custom joystick implementation.
I want this virtual joystick to feed the data to the Input system.
The thing is the left and right joystick works but the dammm button is not working, like i am on this dead end.
And can't figured it out how to make when UI button is clicked and through the virtual gamepad it should trigger that specific button.
I have done so many things but to no vail, the button its not working.
So for the love of god please anyone who know this stuf please blessed me some answeres.
Here is my ControlUIInputBridge,
public class ControlsUIInputBridge : MonoBehaviour
{
[Header("Joysticks")]
public MovementJoyStick LeftJoyStick;
public FloatingCameraJoystick RightJoyStick;
[Header("Input Actions")]
public InputActionReference MoveInActionRef;
public InputActionReference LookInActionRef;
public InputActionReference SprintInActionRef;
public InputActionReference KickInActionRef;
[Header("Virtual Gamepad Settings")]
public float DefaultSprintThreshold = .8f;
private Gamepad _virtualGamepad;
void OnEnable()
{
if (_virtualGamepad == null)
_virtualGamepad = InputSystem.AddDevice<Gamepad>("VirtualGamepad");
if (LeftJoyStick != null)
LeftJoyStick.SprintThreshold = DefaultSprintThreshold;
}
void OnDisable()
{
if (_virtualGamepad != null)
{
InputSystem.RemoveDevice(_virtualGamepad);
_virtualGamepad = null;
}
}
void Update()
{
if (_virtualGamepad == null) return;
Vector2 leftStick = LeftJoyStick?.GetInputVector() ?? Vector2.zero;
Vector2 rightStick = RightJoyStick?.GetInputVector() ?? Vector2.zero;
leftStick.y = -leftStick.y;
rightStick.y = -rightStick.y;
var state = new GamepadState
{
leftStick = leftStick,
rightStick = rightStick,
};
InputSystem.QueueStateEvent(_virtualGamepad, state);
}
}
InputSystem.QueueStateEvent(Gamepad.current, new GamepadState(GamepadButton.LeftShoulder));
Why its not doing it?
I don't want to be that guy but is there a good reason not to just use the built in UGUI-based OnScreenControls?
i need to do custom virtual joystick and need to implement some specific behaviour.
which involves pushing button
also usingunity ui toolkit
i give up on making the buttons working, now I am using OnScreenButton and inherited it and use ui toolkit button event to trigger the think i want
yeah that's what I would've done
man if and only they provide an easy way for this.
Going to bump this. I know there is a way to use the new input system with an event manager generated by using UI toolkit. The problem is that I have no idea how to actually do that. can someone please help?
I just want to control a simple UI with buttons and submenus using keyboard input/gamepad.
This is the fourth video in our Input System series. In this video, we’ll show you how to integrate the Input System with UI Toolkit to navigate and interact with a series of buttons.
You’ll also learn how to use gamepad controls to toggle between different button collections, enabling seamless switching on and off.
More resources:
⭐ D...
I literally just found this thank you 😭
Is ist a good idea in the input actions file to have ona collection for movment, one for moving the camera, one for every diffrent mode the player can be? If you get what i mean
one approach that works well is to have action maps per "mode". and you'd define those by 'actions that are enabled and disabled together' for concrete gameplay/UX reasons. Its also generally advisable to have as few of these modes as possible. Often a whole bunch of things need to be enabled/disabled in those modes on entry/exit, not just input actions. You would manage them all in a fairly authoritative state machine. When you have too many modes, you can start breaking down the action maps further into groups that can combine into virtual mode-aligned maps, but you would have to manage and configure those yourself. In a setup like this you would not enable/disable action in the scripts that use them. And you would be using InputActionReferences to assign inputs for a system.
i've made an input rebind system, and i have this system where u can rebind every button in a sequence, but there's an issue where things like the triggers are recognising letting go as an input and setting triggers twice. How can i fix this?
currentRebind = action.PerformInteractiveRebinding(bindingIndex)
.WithControlsExcluding("Mouse/position")
.WithCancelingThrough("<Keyboard>/escape")
...
this is the code im using rn
Does anyone have a JoystickButton chart for the Switch Pro controller?
I have charts for the other consoles but not that one.
hi so im trying to use unity's input system version 1.14.2 ive created the "move" action which has action type value and control type vector 2 but when i go to add the up/down/left/right bindings nothing shows up for the binding section to actually bind the key. does anyone know why. thanks
that's weird. try checking the unity's default Input Action Asset that they create for you and see what the difference is between what you have and what they have. At worst just copy their Player action map and delete what you don't need.
i did exactly what they did and it still didnt work it also isnt working for the default input they gave me
Has anyone run into the issue where a single key is bound in two action maps (Player, UI) and gets triggered twice in same frame?
When I press "esc" it triggers "OnShowMenu" from Player -> calls MenuManager.ShowMenu -> logic for showing menu + switches action map -> "OnCancel" is called from MenuManager because it's in the same frame as when "esc" was pressed and thus closes the menu immediately.
The mystery is that it only happens the first time. First time I have to press "esc" twice to open the menu, subsequently all "esc" presses work as expected to open and close.
My current solution is to just run "ShowMenu" in a Coroutine so that the "esc" is not read in the same frame. But this feels like a hack.
Here's my current code solution: https://paste.mod.gg/mjgxyvgyeymq/0 - does anyone have any other ways they approached this?
A tool for sharing your source code with the world!
There was a lot of debugging i had to do with this stupid input system, but the way I figured out things to work was from a fresh state. Check if this issue occurs when you create a new project. Make sure your Settings -> Player -> Configuration -> Active Input Handling is not the old one.
ye i have it active input handling (new)
ive also tried both but that didnt work either
when reading the value of a joystick, how do i ignore the distance and just use the angle?
for instance in this image, two joysticks are being held at the same angle but one is pushed further from the center. all i care about is the angle
i just wanted to ask if this is the reason as to why my input system isnt working
and if so how can i fix it
compute the angle from the vector you get
does this persist after restarting unity?
if so, have you tried resetting the library?
yes this happened to me yesterday
and no i havnt how would i be able to do that
close the project, delete the Library folder at the project root, reopen unity
it'll take longer to open then usual due to having to rebuild the library
oh ok thanks ill try that now
this happened now should i just restart the project not much was done just code which i can transfer easily
oh god it's in onedrive, that's probably part of the issue
don't put unity projects in onedrive
moving it outside (and maybe resetting the library again) might work. if not then i guess yeah restarting could make sense
(though btw, you can transfer other assets as well, just make sure to transfer the meta files too)
oh ok ye i just noticed when i created the folder i accidently put it into my uni folder which is in my onedrive ye ill just restart it thanks for the help
Ok so i have this little bug that is driving me crazy
The OnSelect() function on my buttons doesn't trigger when pressing enter when i start the game, but if I navigate once between buttons with the arrow keys then it will work
I'm using Unity Input System and the keyboarg/gamepad, the mouse is disabled on this game
Thanks
What’s your goal? Select is not supposed to trigger on submit, only on navigation events. It triggers on submit only when that submit also selects it, for example when clicking on it and it wasn’t already selected.
Normalize the vector
No, clamp magnitude, then normalize.
Why?
So you don’t get corner bias
Pretty sure a joystick already has its magnitude clamped to 1
Well, the round ones anyway
I found it, it was on my end because of a boolean, sorry
Hello everyone, I've been dealing with this error for a while now. The error appears in the console with the following text:
Exceeded budget for maximum input event throughput per InputSystem.Update(). Discarding remaining events. Increase InputSystem.settings.maxEventBytesPerUpdate or set it to 0 to remove the limit.
To replicate this error, all I need to do is enable Play Mode in Unity Editor, tab out, and wait about 10 minutes. The error will appear with the exception in the console.
I attempted to debug this by going back a good amount of commits in git to diagnose when this issue started, and it's when I used the Package Manager to install the InputSystem (to switch away from utilizing the older InputManager). I also attempted to switch to a different Scene with very few GameObjects and scripts to see if this is a specific scene issue, and this error still appears. I just tested and replicated the steps on the executable that I built from the project, though, and the issue doesn't persist there (like animations are still playing, as opposed what's happening in the Editor's Play Mode).
Anybody have any idea what's causing this error? There's a Unity forum discussion here: https://discussions.unity.com/t/runtime-error-exceeded-budget-for-maximum-input-event-throughput-per-inputsystem-update/916983. There are very few Google searches, and ChatGPT doesn't really have a specific source in the answers that they are giving me
Edit: forgot to mention that I'm using 2022.3.31f (which I believe is LTS), and InputSystem v.1.7
that doesn't sound like an error, and it doesn't really sound like an issue either tbh?
I've experienced this sometimes as well when tabbing out of Unity and leaving it in play mode. I'm not sure what causes it, something to do with input events being queued up while tabbed out and then the first frame you're tabbed back in all the queued inputs exceed maxEventBytesPerUpdate and then it ignores anything over that limit
It can safely be ignored, it's more of a warning / self correcting thing I guess
Maybe you have "Error Pause" on for the console, then everything stops in editor play mode.
Thanks for the replies, y'all. The original InputManager does not have this issue, which is why I'm puzzled why this error is happening in the first place. Coniix's explanation makes sense, but it's a little ... strange that the PlayMode completely stops and exits out (due to the exception), when the original InputManager (i.e. without the InputSystem) didn't have this issue before
I'll test to see if "Error Pause" is causing the issue
Yeah, didn't know about "Error Pause" being enabled, so PlayMode doesn't exit now. The error is still strange
I didn't know that I could investigate the Unity source code via Unity Editor and Visual Studio until now. This is where the error is pointing towards
internal partial class InputManager
{
//...
private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer eventBuffer)
{
//...
var canEarlyOut =
// Early out if there's no events to process.
eventBuffer.eventCount == 0
|| canFlushBuffer ||
// If we're in the background and not supposed to process events in this update (but somehow
// still ended up here), we're done.
((!gameHasFocus || gameShouldGetInputRegardlessOfFocus) &&
((m_Settings.backgroundBehavior == InputSettings.BackgroundBehavior.ResetAndDisableAllDevices && updateType != InputUpdateType.Editor)
//...
}
//...
try
{
m_InputEventStream = new InputEventStream(ref eventBuffer, m_Settings.maxQueuedEventsPerUpdate);
var totalEventBytesProcessed = 0U;
InputEvent* skipEventMergingFor = null;
// Handle events.
while (m_InputEventStream.remainingEventCount > 0)
{
if (m_Settings.maxEventBytesPerUpdate > 0 &&
totalEventBytesProcessed >= m_Settings.maxEventBytesPerUpdate)
{
Debug.LogError(
"Exceeded budget for maximum input event throughput per InputSystem.Update(). Discarding remaining events. "
+ "Increase InputSystem.settings.maxEventBytesPerUpdate or set it to 0 to remove the limit.");
break;
}
//...
I think I discovered what the issue was? If I leave my PS4 controller connected, it would error. But I let the game on for 20 minutes without the PS4 controller, and I haven't seen the exceeded budget exception on the console
well something like that would constantly be sending motion info wouldn't it
if it has that
If the controller is flat it stands to reason it wouldn't (not got a controller to know) but all inputs from controllers boil down to the binary format of 1 or 0 is active or is inactive. The idea of it being slightly active is a check after which says if it's in the 1 state how long did it take to get to that position etc. your keyboard has similar, on key press, key up etc
it would still be sending data, just that it'd be the same data
if it wasn't constantly sending then there wouldn't be any difference between an idle controller and a disconnected one
Even a button held down sends the same data, in the binary instance 1, it should automatically revert hence why you sometimes get input lag
also btw, analog values exist
You can edit the input lag too if you want, it's fun to mess with people
the buttons cost 1 bit, yes, but analog data costs much more
joysticks cost like, 64 bits each
Yes, but it all boils down to the bit format in the end, it can't be in a state of true and false, if it's active it's true even if a little push
to give some context to this controller, it's relatively new. I'm pretty sure that I got it when Monster Hunter Wilds came out, so some time in February
nope, not what analog values are
whoops meant to reply to this
my bad lol
Honestly bravo on timing
I don't know if this matters as much, but my PC is relatively new as well, but was built as a "custom" build. I'm not sure if that gives context to the issue
yeah i don't think any of that really matters too much
so maybe my motherboard has some weird interaction with it
it's just a moderate chunk of data accumulating every frame (or perhaps more frequently with hardware polling, not sure) for a long duration
the data is gonna build up eventually
what i'm confused about is how everyone else isn't experiencing this issue. Surely, other ppl hooked up PS4 controllers to test and let Unity Editor sit as tabbed out. There's only about 3 google results that I can find in regards to this issue
I'll necro-bump that thread that I posted above tomorrow and maybe can get more context
I can hook up my Xbox 360 controller and test if you'd like
The old InputManager never had this problem
that'll be appreciated. I also have a 360 controller laying around and test with that. It's getting late over here, though, so I'll do that tomorrow
If you want you can dm me the script and I'll rig it up
it didn't have the same infrastructure
That's the thing. I don't think I have a script lol. I can send you my InputActions asset to see what the issue is
i have a switch controller and i can say from memory that with the input debugger you can see it giving wayyy more info than keyboard or mouse
I didn't have any Script that utilizes PlayerInput or InputActions
Fine with me
most likely due to the several inertial sensors and joysticks, which would be like, 500B every tick, and the ticks just flow in at an insane rate compared to keyboard/mouse events
oh, I guess I should've posted this in my initial post that I'm using 2022.3.31f (which I believe is LTS), and InputSystem v.1.7
Gotcha. I didn't know that you can hook up Switch controllers to PC like that. I tried to do so for MHWilds, and I couldn't get it to work
(but to reiterate - i don't really think this is an issue, and im not super convinced this is an error either tbh? this sounds like a warning)
Probably not an issue, but my team and I plan to eventually release this game. Unity Editor shows this with a red exception marking and not a yellow warning one, so I wanted to cover my bases just in case
it kinda has limited support, i had to install a 3rd party package to register the hardware as a controller in unity
ahh gotcha
Don't worry, if there's an issue I can find it and probably help fix it.. I broke unity a fair few times
lol believe it or not, that's super helpful to do. I've done my fair share of doing that with Qt
(to clarify - the message says something about accumulated input being dropped, but if it's from when you're tabbed out, do you really care about the input in that time)
Depends on whether it's a memory leak issue and if the input even unpaused is stacked
yeah, I tested that in the executable, and the executable hasn't crash, but our game is still young
yeah, exactly
it'll all be consumed the next frame so once you're tabbed back in it should be fine
input events aren't replayed over time
I don't know enough about Unity, so I'm not sure
Send me your input, my DMS open I'll test it now
(why not just send it here)
Not sure if it's allowed
I believe that I sent it to you, unless I needed to add you as a friend?
yeah minor errors usually don't crash the entire app with the engine supporting it
Odd I didn't get a message
it's also most likely not a memory leak since it's actively discarding excess input
a memory leak can simply be a pointer that contained an object and was not cleaned up properly. it's easier to see it in C++, but we kinda have to "trust" C#'s and Unity's garbage collection if I remember how garbage collections were done
I just started to look at Unity's InputSystem.cs today and was tracing the error
Don't worry, part of Unity was coded in C++ unless they went full native recently
C++ can have tons of memory leaks. Unless Unity fully replaced all their pointers with smart pointers that were implemented in C++11, we kinda have to "trust" that their raw pointers were cleaned up properly, among other things that caused memory leaks
But this is assuming if this is a memory leak in the first place lol. They are at least aware that this issue existed once before, through the forum post and through the issue tracker:
https://issuetracker.unity3d.com/issues/exceeded-budget-for-maximum-input-event-error-appears-when-entering-play-mode-if-setting-inputsystem-dot-settings-dot-maxeventbytesperupdate-to-more-than-0
The steps bellow don't actually reproduce the problem the user is having. The project below sets the maxEventBytesPerUpdate to a val...
I suppose whether or not there's a risk of memory leaks depends on how that inputqueue is handled when unity is running in the background. Is it capped at the value of maxEventBytesPerUpdate (default 5mb) or is it allowed to fill up and only truncated when the input systems Update function is called.
Based on the wording of the error it says "Exceeded budget for maximum input event throughput per InputSystem.Update()" the fact it says throughput would lead me to believe that until the InputSystem.Update happens that the input events are just piling up in the buffer which is then cleared once the max amount of inputs are processed during Update.
So I'd say there's potential of a memory leak there. There's another question of does it only behave like this in the editor or in builds also. Would be interested to see what further investigations could find on this.
You can play around with the settings if you're looking deeper into this and don't want the long wait time when tabbed out to recreate the error e.g. here the maxEventBytesPerUpdate is set to 100kb instead of 5mb to make recreation of the issue a little easier, with that I was able to tab out for a few seconds and it recreated it, with smaller values I found it happened instantly on tabbing out
InputSystem.settings.maxEventBytesPerUpdate = 100 * 1024;
Hi, I have an issue regarding Input Actions (Unity 6). I need a simple system to detect a button press (only active at start and not when button is held), button held, and button released. I am using Button Actions for Jump, Left, Right, Attack etc.
I have tried many things, even making my own system where I have three boolean variables for each input that I set manually inside a custom method for each, but that ends up becoming very cumbersome and convoluted. I can't help but think there must be an easier way to do this, seems like such a basic thing to detect these button states. Context.started, context.performed and context.canceled don't really behave the way I want, and I don't want to have to use booleans for each button and reset certain states in LateUpdate() or at the end of FixedUpdate() or anything convoluted.
I just want a simple way to detect button press states, please help 😄
Hey, how can I make it so a mouse ignores player object?
I want it to act as if player doesn't exist and do the onenter/onexit on an object underneath the player.
Player has colliders, sprite renderer.
It's a 2D game.
I tried adding a player to IgnoreRaycast layer, but that didn't help.
You can decide what the mouse interacts with through Layers, you could in theory tell your mouse to interact with all layers BUT a layer including your player GameObject
How can I do that with layers?
IMapElementComponent, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
I have these to detect mouse input in my world objects.
I want them to ignore player
But I dont want to write if(layer == player) for all my scripts
generally
public LayerMask playerLayerMask;
Then you can do checks against it so in inspector you can allocate the playerLayerMask and tell your code if(!playerLayerMask){ Insert Code here}
Is there a way to simply make my player invisible to raycast?
You can disable raycast on UI elements in the inspector
For some reason my camera had all rayacast layers selected, maybe after I added cinemachine it did that?
I just unchecked one of the layers and it works now
Is it capped at the value of maxEventBytesPerUpdate (default 5mb) or is it allowed to fill up and only truncated when the input systems Update function is called.
Yeah, I haven't touched the valueInputSystem.settings.maxEventsBytesPerUpdateat all within any code or scripts
You can play around with the settings if you're looking deeper into this and don't want the long wait time when tabbed out to recreate the error e.g. here the maxEventBytesPerUpdate is set to 100kb instead of 5mb to make recreation of the issue a little easier, with that I was able to tab out for a few seconds and it recreated it, with smaller values I found it happened instantly on tabbing out
Oh, good idea. Thanks for the tips!
I did a bit more investigation using Windows->Analysis->Input Debugger, and I came acrossed something interesting
The DualShock4 input is always processing due to the contrast toDisabledWhileInBackground flag to Keyboard and Mouse. But the default behavior while I'm active with Unity Editor is strange cus it's constantly always running, unlike Keyboard and Mouse. It's as if I'm swinging the Mouse constantly by default. I put up screenshots with Keyboard and Mouse for comparison (Keyboard has inputs due to me doing Alt+PrtScrn for the screenshot, Mouse has inputs due to me swinging to maximizing and moving it)
Huh, XboxOne controller does not have this issue
Seems like other people are also having issues with a Dualshock 4 controller continuously interacting with events: https://discussions.unity.com/t/inputsystem-ps4-controller-recieves-continuous-weird-inputs-events/952307
I get the same happening with switch pro controller, always firing off inputs.
I wonder if the XboxOne controller not having that is related to what Chris was mentioning about the Dualshock having motion sensor stuff, the switch pro controller would be similar but a quick search would suggest Xbox controllers don't have motion sensors like that
Although looking at the list of inputs in the debugger I can't see anything that would match those sensors, and when pausing the debug feed and clicking into one of the outputs everything is 0 so am not sure
When looking at the live memory for the controller Editor (Current) you can see some weird movement / flipping of bits but it doesn't feel like it directly reacts to movement of the controller, maybe a little but it's weird
what option did you select to view this?
I also found more threads that have this Dualshock PS4 issue:
- https://discussions.unity.com/t/inputsystem-ps4-controller-recieves-continuous-weird-inputs-events/952307
- https://discussions.unity.com/t/ps4-controller-events-firing-non-stop-without-interacting-with-the-controller-on-startup/794517
- https://discussions.unity.com/t/duplicate-device-with-dualshock-4-with-buttons-joysticks-stuck-constantly-firing-events/828952
Clicked on State -> Display Raw Memory -> Bits / Hex -> Editor (Current) from the last dropdown
ahh gotcha. thanks
Hello guys! Soooo I was using the "old" input system (using like "Input.GetKey(Keycode)" and so) and in the same script I've created the "jump" action when you press the jump key and "cancel jump" when you realease the jump key when you're jumping. Then yesterday I wanted to make the android port to the game and so I decided to switch to the new input system but when I tried the jump method it didn't work, the high was like the double as before and didn't even recognize the key when pressed or realeased, though sometimes it acted like normal, its very inconsintent.
I'll send the paste.mod link
https://paste.mod.gg/snsradyenbgd/0
A tool for sharing your source code with the world!
You're attempting to do physics in Update
Physics needs to go in FixedUpdate if you want it to be consistent
But I've tried that too and the same thing happend
Also, before I switched to the new inout system it worked like that, idk why now is glitching
Input handling goes in update,
Physics goes in FixedUpdate
Hi ! I'm making a Unity game in Unity 6 where i need to have Basically Keyboard, COntroller and Steering wheel (Using SDKs) input, but i'm not really sure how to implment it, i've already got my SDK working, i just need to make the inputsystem work
What do you mean by "using sdks"?
The input system has support for all those devices by default
I'm using the LogitechGSDK to supprt my driving wheel (since its the only wheel i have for now)
https://assetstore.unity.com/packages/tools/integration/logitech-gaming-sdk-6630?srsltid=AfmBOoojjbpHoiST8BMZ-pm8JdTkOazVvlah071MmTLO0uk_kNygWmKc you should read the instructions and documentation included in this package
Also, this should not be on the website
Its colpletly broken
Its not up to date
I had to ask supprt for a UTD one
If you have an issue with the package you should bring it up with Logitech
Does anyone know how to read the Gyroscope input from the Steam Deck in the Unity Input System?
When I check InputSystem.Gyroscope.current, there isn't one available. And I can't figure out what kind of binding to set up.
Would it not fall under a delta?
You may need to enable it first:
InputSystem.EnableDevice(Gyroscope.current);```
Oh if current is null that's a different story
Hey! Please ping me if anyone helps out, but is there a way to determine speed? Like for example, if your thumbstick is pushed slightly, the character goes slow, if it's pushed all the way at the edge, the character goes max speed
Unless you're doing something like normalizing your input data, you generally get this for free simply by using your input data for applying motion, since the input data gives you exactly those incremental values.
Oh dope. Thanks!
do you have some specific bit of code or something where you're having an issue with this?
Nope. Just in general was asking. I used to use InControl, but now with the input system, trying it out
Why isn't this working?
using UnityEngine;
using AGS;
using AGS.Project;
using UnityEngine.InputSystem;
using Unity.VisualScripting;
public class PlayerInput : AGSMonoBehavior
{
private static PlayerInput m_Instance;
public static PlayerInput Instance
{
get
{
if (m_Instance == null)
{
m_Instance = FindFirstObjectByType<PlayerInput>();
if (m_Instance == null)
{
AGSDebug.Log("The player input manager is not in the scene", m_Instance, AGSLogType.WARNING);
}
}
return m_Instance;
}
}
public InputAction Move;
public InputAction Look;
public InputAction Sprint;
public InputAction Jump;
public InputAction Crouch;
public InputAction Interact;
public InputAction Pause;
public static PlayerInput Create() => new GameObject("[Player Input Manager]").AddComponent<PlayerInput>();
public override void Awake()
{
DontDestroyOnLoad(gameObject);
Move = InputSystem.actions.FindAction("Player/Move");
Look = InputSystem.actions.FindAction("Player/Look");
Sprint = InputSystem.actions.FindAction("Player/Sprint");
Jump = InputSystem.actions.FindAction("Player/Jump");
Crouch = InputSystem.actions.FindAction("Player/Crouch");
Interact = InputSystem.actions.FindAction("Player/Interact");
Pause = InputSystem.actions.FindAction("UI/Pause");
}
public override void OnEnable()
{
Move.Enable();
Look.Enable();
Sprint.Enable();
Jump.Enable();
Crouch.Enable();
Interact.Enable();
Pause.Enable();
}
public override void OnDisable()
{
Move.Disable();
Look.Disable();
Sprint.Disable();
Jump.Disable();
Crouch.Disable();
Interact.Disable();
Pause.Disable();
}
}
I have a Input Action mapping, but my script can't find the actions
Wdym by "can't find the actions"?
Are you seeing an error of some kind?
Also your singleton logic is flawed (unrelated)
No error. I have my asset in my project. Same map name, same actions, it's not working
What's funny is that because of that code where it tries to find the actions, my gameobject disables itself
Can you tell me how I can make it better? I didn't think I could just make a pure static singleton with the inputsystem
make sure it's assigned in project settings
Is there any accepted practice for determinig if the current controller triggers are bool type vs float types? (ie are they capable of giving a 0-1f value rather than just on and off?
within the InputSystem itself, i don't think so
ButtonControl is an InputControl<float> (inherits AxisControl) so they can both emulate each other (float to bool via pressPoint)
I am just coding it to be tolerant of either yea. Basically if a soft pull is detected (float that isn't 0 or 1) then it sets a bool accordingly.
why? inputsystem can handle this automatically for you
My code itself has some considerations that I don't think it will cover, short of being able to poll and determine what kind of trigger it is
how so?
A soft pull with a 0-1f would add to a chargup value... but if its a bool type trigger, then instead it will charge on pulled and discharge on release. Where as the soft pull will discharge on the full pull instead
huh, that soft pull thing sounds kinda unnatural to me (though i don't play many games). is that a common thing?
I'm not really prepared to go into the nature of the thing I am modeling here, I need to keep working. But that is the thing I am coding for.
The behaviour will be quite different for an float vs bool type trigger.
im just asking if the "soft pull" vs "hard pull" being different actions is a common thing
The thing I am making is not a common thing no, I am making this up and play testing will sort out of it works for this use case or not.
I just needed to know if the input system had any meta I could poll or not
Thanks for the answer btw, that was what I needed to know
Okay so I assigned it, and uhm... my input actions in the inspector are still not filling up. Are they supposed to?
can I use this type of code with the new input system?
{
Debug.Log($"Started dragging: {gameObject.name}");
// Add your drag start logic here (e.g., change visual state)
}```
those in the inspector you're supposed to assign yourself
the one in project settings is so you can do InputSystem.actions
So they don't show filling up when I do FindAction?
They just look empty but they are loaded?
if they don't fill up that means they aren't found
Oh okay, why? I assigned the asset
I got the action map right and the action name
public override void Awake()
{
if (Instance != null && Instance != this)
{
AGSDebug.Log("The player input manager already exists!");
Destroy(gameObject);
}
Instance = this;
DontDestroyOnLoad(gameObject);
Move = InputSystem.actions.FindAction("Player/Move", true);
Look = InputSystem.actions.FindAction("Player/Look", true);
Sprint = InputSystem.actions.FindAction("Player/Sprint", true);
Jump = InputSystem.actions.FindAction("Player/Jump", true);
Crouch = InputSystem.actions.FindAction("Player/Interact", true);
Pause = InputSystem.actions.FindAction("UI/Pause", true);
}
try to use FindActionMap first and then FindAction on that
Oh wait, under the input mode I had "Both"
you can also use the debugger in your IDE to traverse the actions arrays in the maps
Okay I debugged it, it strings out the action map and the action name perfectly, no error there
Okay, I got it working. Now, another question, and please ping me if anyone helps, but is there a way to alter processors in C#?
Turns out I just needed an Event System
does the Input System Quickstart Guide actually work
Cause I'm not getting any Vector2 values or button presses
and the Input Debug window is displaying (no asset) after Actions - Debug Menu/Debug xxx
and there are only these 9 in the Input Debug window
seems like it should work fine
make sure the player settings have the input system enabled
I'm using 6000.0.55f1 and package 1.14.2
tried both and only IS
I tried running play focused and maximized
have you tried the input debugger?
yes
and what does it show?
so hardware input is being received
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
public float Speed = 2f;
private InputAction moveAction;
private InputAction jumpAction;
private void Start()
{
Debug.Log("Hello movement");
moveAction = InputSystem.actions.FindAction("Move");
jumpAction = InputSystem.actions.FindAction("Jump");
}
void Update()
{
Vector2 moveValue = moveAction.ReadValue<Vector2>();
if (moveValue != Vector2.zero) Debug.Log($"Moving {moveValue}");
transform.Translate(Speed * Time.deltaTime * moveValue);
if (jumpAction.IsPressed())
{
Debug.Log("Jump lol");
}
}
}
ive.. never seen those "Debug Menu" actions tbh
only "Hello movement" is printed
are you getting any errors?
nope
could you try logging moveAction/jumpAction
seems fine
if it's relevant, I don't have a Player Input component anywhere
could you try checking InputSystem.actions.enabled and moveAction.enabled?
iirc, the default actions should be enabled automatically, but i can't seem to find that in the docs now.
both false
so, that's the issue then i guess
yeah that's weird...
Project-wide actions are also enabled by default.
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/manual/ProjectWideActions.html#using-project-wide-actions-in-code
yep
could you confirm that the project-wide input actions is set to the right asset?
I used the defaults
oh
so I use Entities and disabled domain reloading
fortunately there's a solution for that in the replies🫡
Because for the love of all that is dear to me, I can't figure out why is it being canceled first before any interaction happens, so...
I'll ask here: Why does this happen? It shouldn't work like that. Trying to separate Tap from Hold for two different actions on same button.
public void OnDash(InputAction.CallbackContext context) {
switch (context.phase) {
case InputActionPhase.Performed:
if (context.duration < 0.5f) {
Debug.Log("Tap");
} else if (context.duration > 1f) {
Debug.Log("Hold");
}
break;
case InputActionPhase.Canceled:
Debug.Log("Cancel");
break;
}
}
Edit: No, putting the cases in different order does not solve the issue.
Is there a proper way to use the Input System without using "FindAction" ? i want to have as little to none string refs as possible.
I found that assigning them in Editor is quite tedious and that there is a "Generate C# Class" thing, that i see basically noone use, but well i cant find much help in how to use that generated file properly.
Does anyone have an tip or idea how to use it properly so i can keep my code clean ?
Not sure about the old system. Might work the same way.
I only know, when using the new one with the "Input Manager" ("Create -> Input Actions"), it allows to export a class of your input mappings,
which allows named access to your maps/actions.
Select the newly created "Input Actions" object in your project explorer, then in the inspector, check the box "Generate C# Class",
then hit "Apply". And always do "Save Asset" when you changes a mapping in Input Manager to update said file.
What it does internally is a different topic, but it saves you from using strings yourself. No clue if "no one uses it" ...
So
var inputAction = playerControls.FindAction("MyMapping/Jump");
becomes something like:
var inputAction = myPlayerControls.MyMapping.Jump;
myPlayerControls would be an instance of that class you define in your script and the other two objects (MyMapping and Jump) are generated with the names you used in the Input Manager for the Mapping and the Action.
Nothing works at all, they should just fix this stupid thing, Input System as usual doing nothing right
you should see if it happens with either of those interactions alone by themselves
how/where are you assigning OnDash to the action
You should use two different actions rather than trying to put both interactions on a single action
Tap and hold are pretty much complete opposites
I guess. As long as it won't send tap signal by accident while trying to hold. The only resource I could find online about that used both together.
You can also check which interaction is being triggered from the context
Which your code is ignoring right now
So you're probably seeing the cancel from the tap when you hold
E.g.
if (context.interaction is TapInteraction)
{
Debug.Log("Tap");
}
else if (context.interaction is HoldInteraction)
{
Debug.Log("Hold");
}```

Hey yall. I started working on mobile factory tycoon type game. I am trying to make pan and pinch-zoom. I am using touch/position for this, but it bothers me - could I be missing something? What is the clean way to make pan, tap, pinch-zoom and two-fingers pan using input system?
you use input system only as the source of the raw pointer data and implement your own 'gesture' abstraction on top. One common approach is to model it after the iOS API for gestures. Or use https://assetstore.unity.com/packages/tools/input-management/fingers-touch-gestures-for-unity-41076
Gotcha. thanks 🙂
Yeah, neither this nor using separate 2 actions worked for me, I still start with cancel then after hold interaction it does a tap. 
Tried to change hold time in interactions too.
don't know what press point is so not touching it
Hi, I want to make it so I have the same Action being possibly triggered by two bindings (press and hold)
What is the best way to do that? should I have two different Actions?
I was trying using 2 bindings under the same action but I couldnt get it to work this way
Just adding two bindings is fine
Will there be any problem in using both old and new input system?
😮💨 this topic was debated.. briefly using old for testing is ok, new recommended for actual full projects, in settings you can also choose both. Do not mix them as in want ("Horizontal") and ReadValue<Vector2> at same time
some build targets don't support it, and it would probably result in quite a bit of spaghetti if you're using both other than for testing or something
I have a strange problem. the first time hitting the Tab key it does not pass in the .started the first one is a .canceled so it doesn't open inventory, but then it works fine after.
Hello guys!!! I have in my Input System the "UI" action map that only has "Pause" on it. Then, when I try to play the game if I start on the level scene (the only scene that has the script that pauses the game) without even selecting my character (starting here is impossible if you don't select your character first) the input works, it pauses. But if I neither start on another scene (the normal gameplay) or I go back to the menu and select my character the pause doesn't work...
this is the code that I use to pause the game:
A tool for sharing your source code with the world!
the Input System (btw the keyboard and the gamepad has the check mark for each one)
and the Inspector
can anyone help me?? I'm very lost
Does anyone know if there is a way to check that an input vector2 value is cancelled because the buttons have been released and not just because two buttons that cancel each other out resulting in the value being 0? I want something to happen when no movement is being input, but cancelled gets called when two opposite buttons are being pressed (e.g. left and right) and I don't want that.
I might just break it into 4 different actions, but that just seems really stupid. Like how is there no option for checking if the input has been released?
You can check in code (Update) without actions but maybe you don't want that.
if (Gamepad.current.buttonEast.isPressed)
That one also returns false when I press two opposite buttons :/
oh, but that's on the action, I could try it without actions yeah. It's not optimal but it might be the best solution
I ended up adding a foreach check to the cancelled callback to make sure no button in the action is pressed
private void OnStopMove(InputAction.CallbackContext obj)
{
// Move.cancelled gets called when the value is zero, so we have to check
// that all the buttons are released to make sure this is because we are receiving no input,
// rather than because we are receiving opposing inputs that cancel each other out.
bool isPressed = false;
foreach (var ctr in obj.action.controls)
{
if (ctr.IsPressed())
{
isPressed = true;
break;
}
}
_isSprinting &= isPressed;
}
Hey, did anyone try to make MultiplayerEventSystem work with UI Toolkit? It seems there needs to be a GameObject for player root 😐
How can I make it so that when I click on a square ( each of them are their individual GameObject ), an event gets triggered?
put a script on it with IPointerClickHandler that fires your event
(it will also need a BoxCollider2D, and you'll need an EventSystem in the scene and a PhysicsRaycaster2D on your camera)
ok thanks I'll try that :>
it works now
thanks again @austere grotto
now I know about le IPointerClickHandler and EventSystem
and physics2draycaster
awesome. I would check out the rest of the supported events too to see what's available. https://docs.unity3d.com/Packages/com.unity.ugui@2.0/manual/SupportedEvents.html
Do u guys have any tips on camera controlling (pinch, pan) on Mobile to make it smoothly ? It is quite hard to test the result
I want the camera to have acceleration
I'm having a weird issue where InputAction.WasPressedThisFrame returns true for 2 consecutive void update calls
The same happens for the performed event
I'm using a button type, the bindings are Spacebar and Press [Pointer]
This is the setup I'm using
Fact checked statements:
- The calls do happen on 2 consecutive frames
- The issue occurs with at least WasPressedThisFrame, performed, and triggered
- The same thing happens even if we use LeftButton [Mouse], it's not because it's pointer press
- The input action is, in fact, a button type
How have you verified that it's happening twice on two consecutive frames?
Time.frameCount
InputSetting update: Poll on dynamic update
Can you show the code and what logs you're seeing
private void Update()
{
if (InputManager.controls.Menu.Confirm.triggered || fastForwarding)
{
Debug.Log($"Click {Time.frameCount} {InputManager.controls.Menu.Confirm.phase}");
SkipTransition();
}
if (InputManager.controls.Menu.Exit.WasPressedThisFrame()) fastForwarding = true;
}
It looks like this fastForwarding thing could also trigger that block
I obviously checked that
I can't assume anything one way or another
Fast forwarding had always logged false
What's inside this SkipTransition function?
fastforwarding wouldn't have been able to trigger the same when it comes to the performed event
If CancellationTokenSource != null, .Cancel,Dispose, set to null
If there was an exception thrown I could kind of still make the assumption that it might've blocked it from finalizing, but I've looked this over 10 times at least and like... This is most certainly not just a simple retrigger
Haven't disabled and re-enabled the action/asset eitger
The last two lines of a performed event callback showed some difference in the two callbacks
However the "NotifyBeforeUpdate" version happens 1 frame after "NotifyUpdate"
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) (at /home/bokken/build/output/unity/unity/Modules/Input/Private/Input.cs:120)
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass10_0:<set_onBeforeUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType)
UnityEngineInternal.Input.NativeInputSystem:NotifyBeforeUpdate (UnityEngineInternal.Input.NativeInputUpdateType) (at /home/bokken/build/output/unity/unity/Modules/Input/Private/Input.cs:105)
Not that I have any ideas on how to interpret this situation
Another thing noticed: It only happens on InputActions, if I access LMB directly this won't happen
copied from general for visibility:
has anyone tried setting Interactions to VR controller buttons in the Input System? I've noticed no matter which Interaction I choose I can't get the button to 'perform'
I'm not really sure to be honest, never seen such a thing
do you happen to have any odd settings in the project, like the input system polling mode set to something different than the default?
Actually, my brother tracked the bug down, but it was literal hours of testing. Apparently enabling onscreen buttons while your mouse is down causes it to reset and pass the threshold a second time
I see
And, weirdly enough the onscreen button does not need to be bound to a related key at all
Because the onscreen button in question was bound to Esc, which had nothing to do with it
Hi, I would like to know how can I do a composition of two keybinds to do an action, for example, Q + D or something like that, and it has to be pressed simultaneously
Hello, i've encountered an annoying issue with the way dualsense controller using the new input system. For some reason when i tilt the right stick to the right or the left, it flickers between gamepad and keyboard and mouse profiles. I'm confused and i have no idea what could be causing it. Any ideas?
Correction: connected my switch pro controller, same behaviour. I have no clue what causes it
Guys how can I make sound effects !?
this is the input system channel, ask in #🔊┃audio
Ok, i think i found the source of the issue. I am using Mouse.WarpCursorPosition to move the aiming reticle... Is there any other way to move the cursor perhaps?
My computer has a problem or Gampad.current can return a saved disconnected device ?
It can return a saved disconnected device
is there a way to enable UnityEngine.InputSystem.PlayerInput for edit mode tests in Unity?
because atm PlayerInput is always disabled so I can't add a user so none of my tests work
im also struggling to get the player user to be valid
Just curious btw if you've read this?
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/manual/Testing.html
Also the docs use player.controlScheme which just doesn't exist.
Yeah, that's what I'm using
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/manual/Testing.html
which version of the package are you using?
maybe it's this and they forgot to update the test? https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/api/UnityEngine.InputSystem.PlayerInput.html#UnityEngine_InputSystem_PlayerInput_currentControlScheme
doesn't work either because the InputUser never seems to be enabled
god this is frustrating, been at it for like 6hrs today 😭
silly question what if you add a single frame wait between creating the player and checking
this is in an edit mode test
can't add wait frames
there's nothing to say I have to use a play mode test though
maybe that's the problem
shouldn't it be a playmode test?
playmode tests are slow and crap
If they actually work though...
we already have like 500+ unit tests running on each PR
they're not using playmode tests
Otherwise it'd be [UnityTest] right?
you can write playmode tests with [Test] too
you just can't simulate frame updates
yeah I'm pretty convinced your stuff isn't working becuase it's not a playmode test.
ill attempt that now
oh fs, that works
REEE why is there no "NOTE: THIS DOESN'T WORK IN EDITMODE" 😡
I basically assume anything that uses any part of the engine or any unity package needs a playmode test
it's only when it's my own pure logic that it can be an edit test
but yeah, it should be noted
Kk, I'll add that to our internal documentation, tyvm
Hey, this is sorta difficult to show evidence of, but when I build my project to test on other devices, all commands related to "GetAxisRaw" seem to stop working for some reason
So everything works fine when testing and in the built game when I'm testing on my PC, but when I go test the build on my laptop or my girlfriend's laptop, no inputs that ask for "GetAxisRaw" work, while all other inputs work fine, which is especially unfortunate given i use GetAxisRaw for player movement
I've really been scratching my head with this one, does anyone have any idea why this would happen or what I can do about it?
Which axes in particular are you using?
not sure if relevant, but may as well - is input handling in player settings set to Old or Both?
whats also odd is that when i replace "inputHor != 0" with just asking for a keycode, the entire thing stops working when said key is clearly being pressed and should trigger the movement
its set to old right now, i could try both
I don't see any GetAxis calls here
whoops forgot to include
also nvm input system is already on "both"
i was thinking it could have issues on some platforms if it were set to both
Hmm ok should I try just setting it to old then?
if you aren't using inputsystem then yeah worth a shot probably
though fwiw, im pretty sure this channel is just for the new input system
probably just one of the code channels or #💻┃unity-talk
alr
well, that last point is a given, since it's the catch-all lol
i'd go with #💻┃unity-talk with this one since i'd hazard a guess it's due to setup/config rather than the usage within code
(try building with this first though, if that doesn't work then let's go from there - and probably also include some more info about what you're building for)
alright well ill just move there but right now it wont let me change to old every time the editor restarts with the changes it stays on both for some reason lol
make sure to read the prompt carefully, i recall it having some odd wording
let's move the discussion there yeah
Is there an easy way to filter out touches that are captured by ui? I have an action that takes any pointer click and I dont want it to fire if I'm clicking on ui
really not much to the action itself
Hey y'all
I get a weird bug with my input-system using game where Dualshock/Dualsense input is "doubled". It seems it's detecting it BOTH as a playstation gamepad and a standard HID gamepad at the same time and processing each input twice.
Any idea how to fix this?
main issue is when playing through steam it seems to work alright, it's just broken when starting the executable without steam input
Hey, I have a problem (the one I deleted before is corrected now !)
Now i have this but the rebind action is not available for the gamepad action, and I don't know why
nevermind, it was related to my previous problem with {GLOBAL} which i remove it, but the name of the action was the same, so Unity didn't understand
Hello I dont have a clear understanding with the input system just yet, im trying to recreate flappy bird and i tried to make the jump input tap only, yet when i hold the button my character still keeps jumping am i missing something in my code or something in the input system menu?
How should we know without seeing your code and your setup?
It could be either, or both
sorry about that here it is
IsPressed() is a boolean representing if it's currently pressed, like Input.GetKey()
you'd want to detect the rising edge, the first frame it was pressed, that'd be wasPressedThisFrame()
oooh okay so i just replaced IsPressed() to wasPressed it would only work once? if so thank you very much
yeah it'd be like GetKeyDown
Weird issue so I have this script thats supposed to take a screen position and send a ray out, telling the item that it has been selected. But for some resason after clicking once the ray REFUSES to change targets no matter what I do! Im over this issue and realllyyyyyyyyyy need help if anyone has advice :)))
You can see it stops updating the position consistently it just like....stops
It's hard to tell what you're talking about, your logs are collapsed
also, your code is using events in a way that is really hard to reason about. It might be better if you changed state using your events but then just ran an Update loop so you could simply see what state you're in
trying to write a test to ensure all of our actions have at least 1 event listener, any ideas how I can do that?
.performed only has a add and remove, I can't get the list of listeners from the unity input system unfortunately to Assert the count
couldn't you just check if it's null or not?
nope, you can't
{
var eventField = typeof(InputAction).GetField("m_OnPerformed",
BindingFlags.NonPublic | BindingFlags.Instance);
var callbackArray = eventField.GetValue(action);
var callbacksField = callbackArray.GetType().GetField("m_Callbacks",
BindingFlags.NonPublic | BindingFlags.Instance);
var inlinedArray = callbacksField.GetValue(callbackArray);
var inlinedType = inlinedArray.GetType();
var firstValue = (Delegate)inlinedType.GetField("firstValue",
BindingFlags.Public | BindingFlags.Instance).GetValue(inlinedArray);
var additionalValues = (Array)inlinedType.GetField("additionalValues",
BindingFlags.Public | BindingFlags.Instance).GetValue(inlinedArray);
var count = 0;
if (firstValue != null) count++;
if (additionalValues != null) count += additionalValues.Length;
return count;
}```
Had to do a lot of fucky reflection to get it work in the end.
Hello.
I need a help check.
My code is not functioning my 3D model, input, I reconfigured it, several times.
oh it's an event rather than a normal field, yeah... not sure about that
It was working, then it broke.
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #🌱┃start-here
copy
I need an answer from whoever wrote this line of code
w h y
all selectables are highlighted OnPointerEnter(when you hover on them) but DropdownItems are getting selected instead
when I realized that's the issue i was so mad
What is generally the better paradigm, using the global input action map, or creating a unique input action map for each script which only includes the specific keys for that script, I.E. wasd is in its own input map that is used by the player controller.
one popular pattern is to make one action map per gameplay mode and to bind the enabled-state of that map to the enabled-state of the mode. Modes would be things like 'menu', 'loading', 'cutscene', driving', 'walking', 'alt/shift/clutch/focus-mode', 'freelook' etc.