#🖱️┃input-system
1 messages · Page 38 of 1
in the new input system
both project use it
same setup and i even copy pasted the c# which works at edit time
problem solved: it was missing a special package from the Switch team
bit of a black box, they need runtime debugging
Hello, I am a bit new to the input system and am having trouble.
Is is possible to disable 1 action from the action map?
I tried .disable() but it stayed on.
@fleet lichen i actually wonder about that too, it was supposed to be possible to unsubscribe but it didn't work for me so i just worked around it by making a delegate and setting whatever action i need to it, and call the delegate with input. and now i'm wondering if it's possible to just change the method it calls, without the delegate
When I don't wiggle my right stick, the new Input System stops registering inputs from it. The built-in Input System doesn't have this problem. The Left Stick doesn't have this problem either.
I'm currently working on my own custom input manager and I followed this tutorial: https://www.studica.com/blog/custom-input-manager-unity-tutorial
which is great and all however he's using
jump = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("jumpKey", "Space"));
for assigning a default value to the key. Is there like a default name for those key names? or can I just use my own?
for example, he uses the string "jumpKey", but could I also rename it to "spaceKey" or whatever?
@low raft you sure that way is better/easier than just using new input system?
@static walrus I'll take a look at it asap. Didn't catch up bout rhat yet
@static walrus Thank you for the info but I am a little confused on making a delegate.
Are you talking about the InputDeviceCommand stuff in Unity.
Sorry still getting used to all the features in Unity 🙂
@fleet lichen System.Action whathappensonbuttonpress = delegate { print("this is before it's assigned"); } MethodThatYouWantToExecute(){} AnyOtherMethodThatAssignsWhatHappens() {whathappensonbuttonpress = MethodThatYouWantToExecute();}
something like this
and then input ctx => whathappensonbuttonpress();
it allows switching what you actually want to do, and i have no clue if i actually did it right, but it works :0
Ahhh ok.
I used something like this for when the button is held down or not.
Would this still hold true when the input I want to stop is the delta of the mouse?
ehh, for delta you'd probably handle it elsewhere, checking if value is lower than you want
Hmmm, I'll have to read up on it more.
The end goal is to stop the mouse from moving the camera if a button is pushed.
@fleet lichen what's causing the camera to move?
@static walrus I have a look action in the input system that gets the mouse delta.
Then I call the delta by returning the Vector2 and finally using that info in the postpiplinestagecallback override for cinemachine.
This gets my virtual camera to follow the mouse.
Looks like this:
Maybe it's not the best way to do this but I wanted to use cinemachine.
so you just make it so that if bool is true, input = get mouse delta, if false, do what you want to stop camera
@fleet lichen
That.... makes a lot of sense
LOL thank you I will have to give that a try when I get home.
@static walrus so... what's the equivalent of the new input system regarding
if (forward has been pressed)
{
// do stuff
}
you assume it always is, you just make a bool to prevent it from doing anything
if i should be able to move, i move. if i shouldn't, i don't. do you have a case where you need to know specifically if it's being pressed?
Yeah so first off I want to have a custom UI for my input system
so let's say pressing jump is binded to the "space" key as default
but if i wanna bind jump to lets say, "return", it'd be bad to say
if (space has been pressed)
{
// do stuff
}
also i need bools that indicate w/e that action is being pressed or not
regardless of the key that it has been binded to if you get what I'm saying
if (inputManager.isInput[0]) { // do stuff }
if (inputManager.isInput[1]) { // do stuff }
if (inputManager.isInput[2]) { // do stuff }
if (inputManager.isInput[3]) { // do stuff }
dir = Vector2.ClampMagnitude(dir, 1);
didDirectionChange = !dir.Equals(direction);
direction = dir;
actionPressed = inputManager.isInputDown[4];
cancelPressed = inputManager.isInputDown[5];
this is my current input system, and it takes the the action regardless of the key that has been specified to it
above are the general actions, and below that are the keys that are binded to that action
i could change the default input keys to
forwardArrow
backwardArrow
leftArrow
rightArrow
etc
and it wouldnt change the way the system works
@low raft hold on i'm not completely getting you, you're worried about rebinding? NIS handles it perfectly
you abstract it by default so you just press jump, and then define jump in settings that can be rebound or multiple different methods of controlling
@low raft This might help
Public bool Inputyouarelookingfor()
{
return controls.action.triggered;
}
The .triggered returns a true if the assigned button is pressed. so no matter what button is assigned the function works the same.
Yes I see that I can bind it to any key I want
In the tutorials I watched so far it's specified to they key , not the action itself however
like brackeys here:
@fleet lichen do you know if it's possible to cancel manually?
@low raft that's the replacement to old
the function will return false once the button is not being pressed
it's not how you're supposed to use it
So in my case I have a IsJumping function
If(IsJumping())
{
//Do stuff
}
And if the isJumping returns false nothing happens
yeah, you can either skip that step entirely or make same bool with NIS
if all you're doing is calling a method there then you skip the step. if you have extra complexity then bool
Well I should ask a simple question before:
Can those keys be manually binded with a UI?
yes
alright so do i have to make a individual binding for each key then to specifiy what direction has been pressed exactly?
because right now if would check if this binding has been pressed, it could be like any direction
it could be vector2d, or you can access the 2D Vector.x and y
so if you need to detect camera looking up/down you just grab .y and see what it does
ohhh yeah i totally forgot about those, however that isn't enough since I need to know exactly which direction has been pressed
there's probably a way but i never needed that so idk
i mean
imagine using controller
you'll use dpad for that? then sure
if it's a stick then knowing what's being pressed is impossible like that anyway, you'd need to check it after grabbing input
How do you rotate on the Z axis for joysticks effectively? Here I am using CS xRot = Input.GetAxis("JoystickX") * joySensitivity * Time.deltaTime; zRot = Input.GetAxis("JoystickZ") * joySensitivity * Time.deltaTime; transform.Rotate(new Vector3(xRot, 0, zRot));
but does this (I am pulling back on the joystick, but it sways side to side)
@tame oracle 6DoF tutorials for starters
Okay
there's also that kinematic demo by unity which has a working flying ship
Do you have a link by chance? Can't find that demo
In this episode of the Prototype Series, we've experimented with creating a procedurally animated boss enemy! Let us know what you would like to see being prototyped!
⭐ Project Download https://on.unity.com/37K5j1b
⭐ Training Session https://on.unity.com/37LQfzV
Timestamps:
00:00 - Intro
00:40 - Assets Used
01:07 - Building the player camera
0...
Thanks
Yeah I realized that there was no issue and that I should probably get some sleep so that I don't waste that much time trying to fix something that was working as intended lol
how do you attach a gamepad button to a UI button?
I am not sure, but UI buttons are only supposed to work only when you click on the button with mouse (or touch in mobile)
Hey guys,
I got a question.
I created a game mostly using JoyPad-Input. And so i created Inputs like this:
Is it possible to map "Attack" to an UI-Button?
right now I'm doing a workaround like this:
uiAttackButton.GetComponent<Button>().onClick.AddListener(MeleeAttack);
uiSpellButton.GetComponent<Button>().onClick.AddListener(SpellAttack);
which isn't that cool...
What i want is to actually do this with an UI-Button:
if (Input.GetButtonDown("Attack") && currentState != State.attack && notStaggeredOrLifting && inventory.currentWeapon != null && meeleCooldown == false)
{
StartCoroutine(AttackCo());
}
Does this make sense?
@formal mesa on button click call method/event?
the best case would be... to trigger Input.GetButtonDown on UI.Button.Click
ui buttons have on button click
yes but I would need to reference the input.GetButtonDown("Attack") to that click
i want my ui botton to do the same as my controller
you're just thinking about it a bit wrong
that might be true
if (Input.GetButtonDown("Attack") || onbuttonclick)
{ if (the rest of your conditions)}
not sure the correct way to do it though
but either way the rest of your conditions are in a method, while the button tap or click call it
also switch to new input system to save headache with different controllers later
it can wait if you're not doing too much stuff though
if ((Input.GetButtonDown("Attack") || uiAttackButton.GetComponent<Button>().onClick)
this says it cant be bool
that was my first idea 🙂
maybe i still got you wrong
why are you getting component
no i mean, you're just poking blindly
idk about old system, in new one you could just assign both the buttondown and onclick as events
yeah there are so many ways to go about it and i don't know a single one, don't want to poke into old system either
i switched to NIS expecting that kind of bullshit
im still suprised i just cant check for true/false for the onClick event
old input's great when prototyping but falls apart as you make game more complex
actually this should be basic.
that's because onclick event is an event
yeah thats actually just what i want
i want to press the ui button and make an attack
nothing more
with those listeners its working fine
but thats some nasty extrasteps
hmm
want me to try doing that in new input system? i'd need a menu eventually anyway
it implies that if i find a solution then you switch to NIS though
it's hard to wrap your head around but it does the job so far
having a problem adding players when I add with a custom layout
the thing will not add when I allow players to spawn
never mind I found out I cannot use both keyboard and gamepad combined
but anyway to figure out player Index when you load a player
?
never mind I found it it
I was trying to see if it would work but could anyone tell me whats wrong ps im beginnerish
like why is it saying i dont have a constructor with 2 inputs
oh, lemmi look it up
@glass yacht how do I
https://docs.unity3d.com/ScriptReference/Array.html i was ref this
ooooh that would explain why ive never got them to work lol. Thankyou @glass yacht
How to check if the player is not moving using character controller ?
Why textmesh pro has only latin letters?
It has a font asset builder, you can add any language support you like
But how? There are 0 tutorials how to do it
Did you try actually looking? Start with manual and dozens of videos on YouTube by original creator how to use it.
I did it.. feeefff, you need to know HEX range to do it, for different languages, whatever it is)
I think if you are adding already made font supporting the language it would be automatic.
Im adding fallback fonts to existing stilized fonts i already have
Hi guys, I’m using a inputactionmap.AddAction() in my code but I can’t find anything to remove that action using script ...
I only find RemoveAllbinding
Any idea what’s the method to remove an action from the actionmap?
nvm found it Action.Remove exist just not in doc or i didint find it 🙂
guys is use somebody a new input system for production on mobile devices ? It's ok, if touch input taked 2ms by self ?
Anyone know how to make
if (Input.GetKeyDown(KeyCode.JoystickButton7)){} a long press button before it it used?
An example: the KeyCode.JoystickButton7 is the Start button on the Xbox gamepad, i want to hold the button for 0.4 seconds before it can execute a command so the single click does something else
@heavy cairn use GetKey() and increase your timer along is true, or use Invoke(methodname, 0.4f); and call CancelInvoke(methodname); if KeyUp
Can you write an example with getkey()?
I haven’t programmed in over 20 years and looking to try something with gamepad but don’t know how to implement what you’ve told me on that previous code
Trying to learn by example
@heavy cairn
if (Input.GetKey(KeyCode.JoystickButton7))
{
timer += Time.deltaTime;
if(timer>0.4f)
{
//here need reset timer or set it to
timer=0;
ExecuteMethod();
}
}else if(Input.GetKeyUp(KeyCode.JoystickButton7))
{
timer = 0;
}
Hi there. Basic question, but I can't seem to find this on Google... How do I get Unity to recognize input from both copies of the Horizontal and Vertical axis? I set up my secondary set to use the D-pad on my controller (6th and 7th axis) but then for some reason the thumbstick stops registering input (x axis/y axis in the default). How do I make both work? Thanks.
Nvm, figured it out. Copied the secondary hor/ver axis one more time and set up separately stick and d-pad and it worked. Thx and gl all.
Sorry in advance for the stupid question. I'm attempting to make use of the new input system. Earlier I started a new project and imported a few basic assets as well as the input system package. I was able to create an input action asset and add the player input script to an object. When I attempted to add a custom event, referencing the quick-start guide (https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/QuickStartGuide.html, example at the bottom), I run into an issue where the script fails to compile:
The type or namespace name 'InputAction' could not be found (are you missing a using directive or an assembly reference?)
Is there something else that needs to be done to get InputAction working? I've been reading through setup documentation, and I can't figure out what I missed, if anything.
I did try finding a solution online, but I didn't have any luck, and I'm just about out of ideas aside from scrapping the project, creating a new one, and trying again.
don't use the new input system unless you need to
I was looking to use it to simplify keyboard/controller support, and there were some things that could be done with it that I couldn't figure out how to do with the legacy input system. Optimally, I'd like to get the new input system working, at least to test it out and compare it to what I had on the legacy system
Ended up creating a new project and imported the input system immediately, without importing anything else... but it's still throwing that error. Has anyone else hit that before?
...nevermind, new project fixed it
On the Package manager page you can import examples which showcase how to work with it 3 different ways at least.
For some reason, the imports didn't automatically detect in the old project. New one had the "UnityEngine.InputSystem" piece that the other one didn't seem to recognize
Hello I have this error with the new Input Sytem
Here is how I set the callbacks
Controls.Player.Tile.performed += ctx => SetMousePos(ctx.ReadValue<Vector2>());
Controls.Player.Right.performed += _ => RightClick();
Controls.Player.Left.performed += _ => LeftClick();
What is it about ?
NullReferenceException while executing 'performed' callbacks of 'Player/Right[/Mouse/rightButton]'
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)
I have a really annoying issue that I've beent rying to solve for days now; essentially buttons dont work at all in a build or when I choose "build and run" on neither mouse nor controller, but they work just fine in editor. Any ideas why this may be?
I even set up a test scene with just a single button - it gets highlighted in build but wont react to being pressed.
I'm using the new inputsystem, I tried all update modes in input system package settings within project settings, and also tried all pointer behaviour on the InputSystemUIInputModule too. Version 2019.4.f1
Has anyone encountered this? Any ideas what I could try?
Managed to fix it, I dont understand why this is the case but after changing the submit action to be interaction: press only, it now all works ¯_(ツ)_/¯
Whenever I use Cursor.lockState = CursorLockMode.Locked; the entire input for the mouse is constantly 0
I guess it's because it's using the mouse delta and the actual cursor doesn't move and has a foxed position, but that's just a stupid thing to have to work around
actually it's so stupid it almost makes the new input system unusable
what game has a visible cursor when in first person view???
Ones that use the mouse for UI interaction without having to explicitly enter a menu
@south pilot how did you manage to confuse tilemap collision nullref with input system
Yes I get it now. I fixed the problem. Thank you ! (What I think is strange is that with the old Input Manager I didn't get the problem so the vector3 is not null, still there was a problem I don't know why)
is there a way to flip my Input axis based on character direction?
I have a motion input system where the "Horizontal" input returns "Left" or "Right" so the player can do directional inputs. currently its based on character direction
so basically if im facing north and press Left on the stick it returns left, If i press the stick right it returns "Right". if the character turns around then this should flip, so that it matches the controller and the character doesnt jump the oppposite direction
because if the character turns around then Left on the stick is Right for the character so i dont want him dodging to the left
this is probably an awful way to explain it but if anyones got any ideas i can show the code and a video of whats going wrong
@severe sorrel Well ,you have to "flip" it by yourself, not in the input setting. Check for the character direction and flip it
but is hard to imagine what you have over there, can be anything with that explanation
Hi, I am pretty new to game development and have been trying to learn the new input system for VR development. Right now I am just trying to console log a trigger value from my Rift S controller. I have my XR Rig set up with the default input actions and I am able to log out the trigger value but it only logs 0 and 1 values not the float value. The attached image is of the PlayerControls script that is logging the value. Any idea why this isn't logging the in-between floats?
Hello, not sure if answered already, but whenever i try to cancel a rebind in the new input system, it actually rebinds to "anyKey"
My rebind operation is set up with ".WithControlsExcluding("<Keyboard>/escape")" and also ".WithCancelingThrough("<Keyboard>/escape");"
Also, for some reason, rebinding to the arrows when the num lock is pressed rebind to "print screen"
just realized that we can only use one "with controls excluding" any work around?
Is it possible to simulate the AI having its own controller? I have a movelist with follow ups and id like the AI to be able to for example Spam the attack button and go through the combo without recoding it all
for example instead of starting a new state i could treat it like he was holding a controller
and take taht input
so when i want him to attack i could do "Press Square on this controller"
You should abstract that, create a class "brain" that controls your character and has implementations that take a controller input to say what actions to take and implementations that take an AI to say what actions to take
so when you mess up writing that script, then you can say, "oh no, my brain is broken!" or, "my brain has bugs!"
hey guys, would someone mind helping?
Hullo! Could anyone tell me how to go through inputaction assets programmatically? If possible at all?
is there any way to poll actions instead of receiving them as events?
nvm found how to do it I think
How?
wait I can't use the actions I've already set up in the inputactions thing
smh
if anybody knows how to get the inputactions from the inputactions asset / generated class I'd like that
nvm, found out how, have to create a new instance of my generated class and get the actions from that
👋
im using the new system and broadcast messages, the event do not get triggered tho. i created the system added the player input and hooked the system into it. is there a magic step to get it working or am i just retarded?
this is driving me nuts
I love that the doc talks about these functions but they straight up don't exist in the package
at least for me
i made it the "old fashion" way by exporting the script and binding the actions
useless code but whatever
nvm it's only in the preview version, which the doc defaults to despite it not being available in the package manager
@glacial thicket did you copypaste it as is or inputaction.state.button.ispressed?
Hey does anyone know how to fix this issue? I can’t get the input system working at all, the properties panel and input debug window are completely blank.
I tried with different versions of unity and the input system and no luck.
Here is a better picture
This is probably a really basic question, but I want to add behavior to an object where clicking on selects it, and then pressing numbers causes it to show whatever the last number pressed was (for tiles in a number puzzle). Would you recommend I use a text input box or should I custom script it using a text box and a button? Any good tutorials related to this topic?
What's the reason for using the input system?
to use controllers
Thanks @icy ferry
Hey I have this move thingy with a vector2, I use it to well move the character with a simple rb.velocity = context.ReadValue<Vector2>();
But I have a problem, when I pressed right key and after the left key (and so getting both of those key pressed) the vector 2 x is equal to 0 instead of 1 ( like it would with the Input.GetAxis). So how could I fix that ? It make the character stop and it's really annoying :/. I thought about detecting which binding is pressed but I also don't know how to do that x)
I need help 😦
Why when in IPAD and in Editor it doesn't result the same output ?
bool HitTestUVPosition(ref Vector3 uvWorldPosition)
{
RaycastHit hit;
Vector3 cursorPos = new Vector3(Inputs.Position.Position.ReadValue<Vector2>().x, Inputs.Position.Position.ReadValue<Vector2>().y, 0.0f);
Debug.Log("Cursor Pos " + new Vector2(Inputs.Position.Position.ReadValue<Vector2>().x, Inputs.Position.Position.ReadValue<Vector2>().y));
Ray cursorRay = ViewCamera.ScreenPointToRay(cursorPos);
if (Physics.Raycast(cursorRay, out hit, 200))
{
MeshCollider meshCollider = hit.collider as MeshCollider;
if (meshCollider == null || meshCollider.sharedMesh == null)
return false;
Vector2 pixelUV = new Vector2(hit.textureCoord.x, hit.textureCoord.y);
uvWorldPosition.x = pixelUV.x;//To center the UV on X
uvWorldPosition.y = pixelUV.y;//To center the UV on Y
uvWorldPosition.z = 0.0f;
return true;
}
else
{
return false;
}
}
It was working fine couple of days ago, I'm not sur of what I changed or something, and I was about to release my app
and does someone know how to use multi tap interaction ? It doesn't change anything for me :/
nvm I fixed it myself
I am wondering if there is a reason that the trigger values I am able to log out of my Oculus Touch controllers read from the low end of 1.43533 E-14 to 0.9999999 and not 0 to 1. Anyone else have this issue and have a way to resolve it?
so im trying to make a third person shooter game where the look angle is controlled with the mouse (like most FPS/TPS games). my script is working well, however when the mouse cursor hits the edge of the screen, i can't rotate my view any further in that direction. is there a way to snap the cursor back to the center of the screen at the end of each frame after i've done all my calculations using the cursor's position?
https://docs.unity3d.com/ScriptReference/Cursor-lockState.html
Lock the cursor
am i supposed to use this in conjunction with Cursor.visible? because that's what i tried and it doesn't allow any mouse movement at all
You can. It wouldn't allow for mouse movement but it should still accept delta input
where am i getting the delta from? is there a mouse delta variable in the Input class?
currently i'm doing:
Vector2 oldMousePos;
Update()
{
Vector2 mouseDelta = Input.mousePostion - oldMousePos;
// do stuff
oldMousePos = Input.mousePosition;
}
https://docs.unity3d.com/ScriptReference/Input.GetAxis.html
Mouse X and Mouse Y axis
ah, thanks
Hey :) I need to get key input while the "game" isnt in focus. I try to make a tool that is basically a chuncked walkthrough of PoE for the second screen and want to switch hints back and forth with 2 hotkeys
@tropic oxide That might be called keylogging and is not allowed I think.
Or you have another application that listens for those hotkeys, if you mean that
How do other apps like LiveSplit, OBS, Teamspeak handle this issue (using hotkeys while not being in focus)?
I am currently trying out the new input system but whenever a button is pressed the event is called thrice
anyone know how to fix this
bool keyA_pressed = false;
if (pc.General.keyA.ReadValue<float>() > 0f && !keyA_pressed)
{
//do stuff
keyA_pressed = true;
}
else if(pc.General.keyA.ReadValue<float>() <= 0f && keyA_pressed) {
keyA_pressed = false;
}
Please use code tags, this is jus tunreadable, or use hastebin
how do I use code tags 👀
three times ` before and after your code
if (pc.General.keyA.ReadValue<float>() > 0f && !keyA_pressed)
{
//do stuff
keyA_pressed = true;
}
else if(pc.General.keyA.ReadValue<float>() <= 0f && keyA_pressed) {
keyA_pressed = false;
}```
@west tulip Not sure if its state of the art, when I used the system several months ago it had no OnPress or OnRelease functions.
@tropic oxide What hotkeys are you actually talking about? Like with a StreamDeck and so on?
No, the basic keyboard hotkeys. You can start recording ingame, mute yourself in teamspeak or make a timestamp without those apps being in focus.
Hm, good question. Just wondering how those hotkeys are overriding for example an ingame hotkey.
Anyone? 😢
Hey guys, can someone help me with that?
Hey anyone here have experience with setting up controller inputs with the new system?
Will pay for some help lol
Anyone ? I'll pay.
Not a place for that. Examples are in the package imported in Package manager separately.
Is there a place to hire someone for help then lol. i have it installed im having troubled with variables
There are game dev communities with job boards, not here.
You could just ask here for stuff instead of asking if there is someone that can help 😄
@chrome walrus yeah fair enough ahah
Hello!
Does anyone know if the New Input System is compatible with Unity Remote 5? I can’t seem to get it to detect touches
I’m fairly sure I have everything set up correctly because I’m able to get a mouse click to work with the same code I want to use the touch with
short answer: it isn't compatible 😛
Hello everybody! I'm new here.
I'm very interested in the new input system, but I don't know where to start and where to find tutorials
Could someone help me?
Do the demos come together when installing the package?
In the Unity Docs it says
control schemes impose a set of devices requirements that must be met in order for a specific set of bindings to be usable
about control schemes. So, how can I know which control scheme is being used in my project and is there some sort of event fired when the control scheme is changed?
how on earth do i convert TextMesh Pro UI - Text input to an integer?
Debug.Log("Playing custom game:" + CustomGameTextInput.text);
it prints the correct output, e.g.:
Playing custom game:1234
I can show the text in a Debug.Log and it looks right, but then when i do:
int result = int.Parse(CustomGameTextInput.text);
I get:
Format Exception: System.FormatException: Input string was not in a correct format.
can anyone point me in the right direction here? i've tried googling to no avail.
This isn't really an #🖱️┃input-system question, but you just need to trim the end off of the input string.
.Trim() gets most of them, but I've seen it require a .Trim('\u200b') in the past
my bad, and thanks, it works!
which channel should i have asked about the UI TextMesh stuff in?
Hey guys, a bit new here...
I'm learning animation transitions, I need a way to transition states by 1 condition or another.
but NOT both are required to be true, just 1 or the other.
also im curious about what the difference of these transitions are
ah ok, found it out, I needed 2 transitions (the triple arrow). I had to set the first condition on one of them, and the 2nd condition on the other.
hey anyOne know a simple input system for example when u drag up ur finger in the screen the person jump or if drag left or right the person go left and right
i need only the input system
if(input....)
????????????
Do not cross-post. Use one channel at a time please.
Hey guys. new today to the InputSystem. Got it going code seems fine. But i have inverted controls! So W = going left S = Right A = up. Not sure what i may have done wrong. Any help would be great
What would be the correct way to get a mouse input the way you could with "Mouse X" in Input. I've tried delta but it didn't work correctly
Hey i need some help !
Is there a way to make controls for mobile with the input system?
If yes how
@ me if anyone figures it out
sprite + button + your event(move) @heady silo
Ty!
I wanna add joy stick and jumping button and crouching and aiming area who knows how to help me pls ping
And it would be better if its on another script not the same as the fps script cause fps script is big and I dont wanna mess it
So basiclly I need code that can work with key board and mouse when plugged and for touch joy stick jump and crouch or just tell me how to make i will make it cause I cant think of a way
Pls.
There probably are events in the new input system for when new device is detected
There seems to be few events mentioned here https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Devices.html#device-creation
thanks m8
Guys, I'm using the unity new input system and I'm having issues when trying to drag objects with the mouse cursor.
this is what my code looks like:
public void DragMe()
{
Vector2 movePos = new Vector3(Mouse.current.position.ReadValue().x,
Mouse.current.position.ReadValue().y, gameObject.transform.position.z);
gameObject.transform.position = Camera.main.ScreenToWorldPoint(movePos);
}
is there any advantage to using
{
//things
}
if (Input.GetKeyUp("W"))
{
//opposite things
}
to detect inputs instead of just
{
//things
} else
{
//opposite things
}```
?
besides a possible one frame delay i just dont see it.
They are fundamentally different
one does something only if down or up (single frames)
the other does something always (either held or otherwise)
So the only thing is an extra process running always. okay.
Hi there! I'm currently making a click-to-move mechanic using the New Input System. I'm trying to avoid hard-coding the controls.
Is it possible to get the Vector2 mouse pointer position only when I click the left mouse button without having to call Mouse.current.position in my code? The ButtonControl returns a float. How do I make it return the Vector2 mouse position instead?
I created this thread in the Unity Forum. https://forum.unity.com/threads/mouse-click-to-move-using-the-new-input-system.1041241
I hope someone answers.
Hey is there any way to simulate more than 1-finger-touch with the Simulated Touchscreen on the new input system ?
How one does access the input actions asset programmatically, I'd like to make a tool that "magically" create a rebind screen and this is the first step. Can we start from the Input asset directly or do we have to use the generated class? For the rebinds, we use the class too though? Any way to generalize this for a tool?
If your using the new Input system with keyboard and mouse you can map those same input to a button. The new input has a script called on buttons or on stick and you tell the buttons if to behave like a ps4 input or regular gamepad.
Nope not new input system didnt work with my fps script
can i make unity control my computer? like if i hit a certain wall in the game it will input W on my keyboard, is that possible?
you can use an external library
Guys, is the Input system compatible with the new UI? And if so, any pointers on how to make it work?
@copper night Need to change some stuff on the EventSystem on your UIs
I believe it's one click to convert
can sombody help me?
like when you put your name it says your name back in a different scene?
You want to store the name? I would start with player prefs @humble lichen google will give you resluts about them
Hey, is it possible to use the Input System with the Steam Controller in the editor? Unfortunately a steam controller is the only controller I've got at the moment.
Hm you should have buttons like D-Pad without being specific to Xbox or ps4 or whatever, just try it out.
Having messed with it a little, it seems that the steam controller is listed under unsupported devices in the editor, and it can be used pretty well with the editor, but it is actually just sending keyboard and mouse inputs, rather than any Xinput button presses or anything like that. I've read online that you can add the editor to steam in order to get the steam controller to work properly, so I might try that next. Really, I think this is more a Valve problem than a Unity problem.
It's a little unfortunate because it seems like if I want to have a game work with the steam controller without requiring it to be launched via steam, I have to bind a bunch of keyboard buttons to actions in the game, which might conflict with the normal keyboard controls.
I finally got this to work by adding the version of the unity editor I am using to steam and adding the command line argument -projectPath "E:\Unity Projects\YourProjectHere" to the "game" properties in steam. This results in the device being recognized by unity as an Xbox controller. Whatever controller configuration you set the the unity "game" in steam will determine what button presses are sent to unity when configuring the controls. I don't think this method allows you to access any of the raw input from the touchpads, as the input is converted into joystick input by steam.
@chrome walrus hm? google doesnt help what should i put in google?
@humble lichen https://docs.unity3d.com/ScriptReference/PlayerPrefs.html
I am not the guy that helps at every little step... put some effort in it
Hello
I installed the new input system and now UI and eventssytems are gone how can i refrence a text object. Text dosent work anymore
and TextElement dosent do anytthing either
if(Keyboard.current.wKey.isPressed) { movement.z += 1; }
This line of code makes VS underline Keyboard even though I have the new input system installed, because, it doesn't exist in the current context.
What's wrong with my script exactly?
@heavy dome Likely missing an using statement. Right click -> Quick suggestions on the line and it will probably show you the right one
Do you have any InputSystem setup?
How can i get input from mouse?
Old or new input system?
New
Mouse.current
Yep that worked, thank you!
InputManager.Controls.Player.Move.canceled += ctx => ResetMovement();```
InputManager being highlighted red because it is inaccessible due to protection level. What am I doing wrong?
Any help appreciated ty.
@heavy dome It's a bit hard to tell without seeing more, but it likely has to do with your use of access modifiers https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/access-modifiers
as if it wouldnt
@heavy dome you dont reference InputManager directly if I remember well, it's internal
you should get a refrence of your InputAction something like that
and .Enable() it
or you Unity can code-gen a controls class for you based on what you set on the editor
errr... double-check the manual, it will be easier ^-^"
What the hell am I writing ? xD InputManager is a your Singleton to handle input probably ....
you would want to create an input system for more precise customization and easier access to what inputs you want to do what in a game @bleak ermine, so a potential player can make jump whaever he wants and we dont have to type in input.getkeydown(Keycode.W) whenever we want our character to move forward.
Actually i think this is applicable here. if what I am doing is considered crossposting please let me know, even though i am deleting my previous message.
So this is an issue i have been having all freaking day and im honestly incredibly done.This might be a wall of text.
The Situation: Currently, I have a working Main menu using buttons, EventSystem, and Event triggers. I navigate using A and D or Left and Right according to the default InputManager. The input module for EventSystem is the StandaloneInputModule. All inputs work, I can press submit, it works.
The Issue: Whenever I click on anything with Mouse button 1, It unselects everything and it is not able to reselect anything, even with a click. My current band-aide one the issue is that whenever the EventSystem property currentSelectedGameObject == null, I set the selected module to a random button. I do not want this to be my fix.
I do know it is specifically when i click on the screen anywhere.
What i have tried: I have tried Making a copy of StandaloneInputModule and trying to edit the script to rid myself of any mouse inputs, but it doesnt seem to like that, no matter what area I comment out. I am unfamiliar with inputmodules so it has been a really hard issue for me to fix.
Is there any way i could just rid mouse inputs from my input module in this scene? is there a method that i cant seem to find on the unity UI Scripting API? Is my idea of Making a new inputmodule that doesnt respond to mouse inputs the correct way to go about this?
Hi everyone,
I'm trying to create a simple local multiplayer lobby :
Press a button to enter -> select character -> confirm
any idea of a good way to do that with PlayerInputManager ?
Ok i fixed the issue by scripting my own lobby with its own input to join / choose a character / save the device used to join
I then set the "PlayerPrefab" variable from the PIM for the chosen character and use the JoinPlayer method to instantiate it + define the input device
I'm trying to make my player move every time I click the mouse so one click equals for example 1M anyone help little confused
can someone help me
i added sprinting into my "game"
but i wanna disable it when im moving backwards
here's my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController controller;
public float speed = 12f;
public float gravity = -9.81f;
public float jumpHeight = 3f;
public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
Vector3 velocity;
bool isGrounded;
private object playerCol;
// Update is called once per frame
void Update()
{
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
if (isGrounded && velocity.y < 0)
{
velocity.y = -2f;
}
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * speed * Time.deltaTime);
if (Input.GetButtonDown("Jump") && isGrounded)
{
velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
}
if (Input.GetKeyDown(KeyCode.C))
{
controller.height = 3f;
}
if (Input.GetKeyUp(KeyCode.C))
{
controller.height = 3.8f;
}
if (Input.GetKeyDown(KeyCode.LeftShift))
{
speed = 20f;
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
speed = 12f;
}
velocity.y += gravity * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);
}
}
if (Input.GetKeyDown(KeyCode.LeftShift))
{
speed = 20f;
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
speed = 12f;
}
and here is where i put the sprinting
ik its bad im bad
how do i do it so it dosent sprint backwards
You can use the dot product to check if 2 vectors are in the same direction
if (Input.GetKeyDown(KeyCode.LeftShift) && Vector3.Dot(move, transform.forward) >= 0)
{
speed = 20f;
}
Maybe start with something like this (not tested)
@tame oracle
the dot product equals 1 if vectors are in the same direction, 0 if perpendicular, -1 if opposite direction
should probably normalize the move vector, as you multiplied it with user input
Vector3.Dot(move.normalized, transform.forward)
can someone help me this? I'm trying to make a 3rd person game where WASD/arrow keys moves the player relative to the camera
I've got this code that rotates and moves the player: https://hatebin.com/rdqfirrqwc
and it worked great until I added the ability for the camera to rotate around the player
I know I need to replace player_capsule.transform.forward with something to make the new motion relative to the camera and not the way the player is facing
but I'm not sure what it needs to be
camera.forward?
my mouse isn't being detected by the input system. How do I fix?
this is my setup for the mouse
Look Action is a Action Type Value with COntrol Type Vector2
are inputs for nintendo switch pro controller on pc broken in unity 2019.4.11f1? it's doing really weird inputs
yeah they're completely wrong, despite my controller working fine on other games
@glacial thicket oof.... i'll check this when i get home w/ my switch. was gonna have to deal with this sooner or later. were you Wired or Bluetooth?
wired
I'm having an issue with DS4 controllers. I use Gamepad.current.startButton.wasPressedThisFrame to pause/unpause the game. That's the Options button on the DS4 controller. In the editor it works perfectly, but when I build it, it only works sporadically.
anyone else encounter this?
@winged orbit are you sure you're checking in the right update loop?
It's in Update() . I check for escape key there too and that works fine.
make sure InputSystem is set to Update
(it would be by default if you didnt change it)
I didn't change it.
do you have more than one gamepad plugged in?
Yes
Is that an issue?
It's a local multiplayer game, so I want any of the players to be able to pause.
ok but if i do camera.tranform.forward like in this script it always goes forward no matter what I press
so you can see right now that as the camera spins and I hold down W, the player runs forward constantly
but I want the player's "forward" to change when the camera angle changes
same with backwards, left, right, etc
so I guess what I need is still this line: player_capsule.transform.rotation = Quaternion.Euler(0f, angle, 0f);
but I need some way to add the camera's change in rotation to the calculation of my angle variable
@lime temple did you look at my example?
yeah I looked at it but it didn't look like there was any camera rotation in the example scene
rotate it manually 😛
and the script said camera.transform.forward
but if I do that, it'll always move towards camera forward
even if I'm pressing backwards
//get the forward facing direction of the camera
Vector3 cameraForward = Camera.main.transform.forward;
//zero out the Y axis (this is the lazy way, not 100% accurate and wont work for extreme angles)
cameraForward.y = 0;
//generate a rotation to rotate your inputs around
Quaternion cameraFlatRotation = Quaternion.LookRotation(cameraForward);
//rotate yout input vector based on the camera's "Heading"
input = cameraFlatRotation * input;```
code is nice n' commented
you are rotating your input by the camera's rotation
this gives you a world space vector to move a character in (ie: pressing "Up" on a joystick or W/Up key will always move the object away from the camera)
if your character isn't incorporating the input vector, then it wont do that
Still not sure why this wasn't working, but I fixed it by using a callback context instead of polling in Update
@winged orbit yea, that was my next suggestion. TL;DR polling is a bad idea with the new InputSystem for arious reasons
diferent controllers function differently (some stream constant rate, others like XInput are event based)
if you use Actions instead of directly querying a controller, you'll have better results 😦
i submitted some significant design paradigms to Rene-Damm that they're slowly starting to look more like 😛
should make a lot of that more sane
hey so i've got this camera rotation code
and the first five lines work great to rotate the camera round the player but keep it always looking at him cause it's a 3rd person game
the bottom three lines work great to allow mouse movement up and down to change the camera angle
but the two code blocks don't play nice at all. the bottom three lines are overriding the x-rotation somehow
I don't understand how this line is wrong:
transform.rotation = Quaternion.Euler(currentRotation.y, transform.rotation.x, 0);
the x-rotation should be staying constant
but instead it does this
on the other hand, this is what it does with the last 3 lines commented out. you can see the x-rotation works fine, but moving the mouse along the y-axis does nothing
@west oracle hey are you still around? I could really use help with this
Dinner, I'll be on in a bit
ty bb
@lime temple here
transform.rotation.x this is a quaternion. you probably want eulerAngles
i switched it to eulerAngles.x and now it's rotating around the player, but not looking at him anymore
so in the two videos I posted above you can see the two features I want
mouse moving up and down will angle the camera up and down
mouse moving left and right will rotate the camera around the player
but when I try to implement them together it messes it up
so....to be honest, Cinemachine has pretty much got this down to an absolute science
so fi you really wanna re-invent it just to do it, thats cool, but Cinemachine really does a great job
my experience with cinemachine is that if something breaks, I don't know how to fix it because I don't know how it works
plus there's a lot of overhead that I really don't need, and I can't figure out which features I want and which ones I don't want
as opposed to?
oh i've been using getAxis
oh ok
but tbh I don't know the difference
uh... a lot lol. if you hate cinemachine because you can't fix it, you'll hate InputSystem more 😛
lol
@lime temple
this looks like what I want
let me try and integrate it with my other code
ok everything works great! but if I wanted to zoom the camera in or out, how could I do that?
yeah i tried changing that in the editor but it didn't seem to change anything
probably cause it gets set in start
is it possible for anyone to lend me a tilt controlled arcade style car controller?
so there are no errors showen but the code doesnt work the camera doesnt turn
@tame oracle Did you get the reference to the player's body?
meaning, did you drag the body into the empty square in the inspector?
VS code doesn't have any errors with the code, the jump input doesn't work.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
This is driving me nuts lol.
Oh sorry fixed it already but yes that was the problem
Hello everybody.
I have a very basic code running in my Update function that sets the vector2 movementInput to the raw input of the right/left and up/down arrow keys.
The getting horizontal input works fine. But there is about a 1 second delay when setting the input to the vertical axis. Why is the vertical axis delaying?
Use GetAxisRaw
you're using raw for the x
and not raw for the y
GetAxis applies some smoothing to the value
Currently getting an error on the InputManager variable on lines 16 and 17 saying that it's inaccessible due to its protection level. (This is a repost from a few days ago, except now I am including my code)
Hey, can I somehow disable mouse in new input system? I want to use Keyboard and/or Gamepad but when I click with my mouse the PlayerInputManager (which is set to automaticaly spawn) spawns another player for that mouse
the spawn behaviour for PlayerInputManager has a "Join Behaviour"
@uncut crater
use the action or manual method to override the default behaiour
is it still important to multiply certain things by Time.deltaTime, or are the brackeys tutorials a bit outdated now?
yes it is still important
and it's still "certain things" not all things
is there a way to disable player input on the new input system
have smth like this right now:
void PauseGame ()
{
//Time.timeScale = 0;
controls.Disable();
}```
time.timeScale = 0f; should be ok
that works but is there a way to just disable playerinput
doing controls.InputName.Disable() works for me
InputName is the name you gave to the ActionMap
okay so now I now have another problem lol
hey, i want to create something like choosing character by moving focus to the Choose Character (input/button/focusable) and by pressing left or right my script will change characters (characters wont be focusable, focus will be on the Choose Character field). Is there a input like that or I have to write it on my own? I don't have a problem with it and I know how I would do that but I wouldn't like to create something on my own if there is a built in feature 😄
@uncut crater so you want to choose a character based of looking at them?
Nah, let me show you how I would create it in code and maybe you will tell me if there already is something like that.
Let's say I have a button called "< Choose Character >".
WASD/Arrow navigation.
Player moves focus to the button. My code recognizes player is focusing this button. Player performs left/right input. Script receives it and changes character accordingly.
So like you want to move based off of wasd or am I not reading it right
Or by analogy like settings. Like this one:
you change focus by up/down, and change value by left/right
Oh so ui? Ok I'm pretty sure by default you can make either yourself or in code that when you make ui next to each other unity links then and you can use arrow keys
your description was good 🙂 i was just busy eating crackers 😛
@uncut crater blackthornprod has a series on it
Hello I'm trying to implement a touchMove detection event with the new unity input system. I made event for start touch and end touch but I can't figure out how to implement the move touch. If someone can help would be appreciated 🙂
Here's my code
using UnityEngine;
using UnityEngine.InputSystem;
[DefaultExecutionOrder(-1)]
public class InputManager : Singleton<InputManager>
{
private TouchControls touchControls;
private void Awake()
{
touchControls = new TouchControls();
}
private void OnEnable()
{
touchControls.Enable();
}
private void OnDisable()
{
touchControls.Disable();
}
private void Start()
{
touchControls.Touch.TouchPress.started += ctx => StartTouch(ctx);
touchControls.Touch.TouchPress.canceled += ctx => EndTouch(ctx);
// touchControls.Touch.TouchPosition += ctx => MoveTouch(ctx);
}
private void StartTouch(InputAction.CallbackContext context)
{
Debug.Log("Touch started " + touchControls.Touch.TouchPosition.ReadValue<Vector2>());
}
private void EndTouch(InputAction.CallbackContext context)
{
Debug.Log("Touch ended");
}
// Here I need help
private void MoveTouch(InputAction.CallbackContext context)
{
Debug.Log("Touch moved");
}
}
and a screenshot of my action map
did you try the .performed?
inputSystem.Interaction.Position.performed += ctx => touchPosition = ctx.ReadValue<Vector2>();
Just alter it to your input names, but this is what I am using
I'll try let me a sec 🙂
That's exactly what I needed thanks !
Just a thing, is it normal that a touch is detected even outside the Game window ?
Yeah, thats some thing of the editor, that I don't know if its intended or not. Not sure if you can alter this to just stick to gameview or not, because your screen of obviously bigger than the game window. If its not breaking anything, I would not care about it.
Lock input to game view isn't working or I don't understand what it means then
Maybe its locking the cursor to it, I dont know. But to be honest, I had issues with those settings. The simulate touch just made my events fireup twice because I was using touch as input but still got the mouse as another touch triggered too, weird bugs there 😄
is there an easy way to convert keycodes to strings? like the actual key, not the name?
(e.g. 0 instead of Alpha_0)?
Where is the keycode coming from? Input.Key?
i have a bunch of keycodes and a ui where i want to show the key for each slot
so i store KeyCode[] for the slot keycodes
and want to show those keys in the ui
so keyCode.ToString() is not working?
it is, but i don't want to show the player Alpha0, i want them to see 0. i just will write a little converter. if (keyCode == KeyCode.Alpha0) text = "0" and so on
Yeah, i guess you have to, you can just make a Substring thing and cutout the parts, if it contains alpha, remove that part.
nah that would be too much overhead, some simple if functions are more effective, also there are other cases with Escape and such
I was not expecting to do the substring on update 😉 But yeah, if you want to simple if, go ahead, still comparing strings there 😉
this will get probably even more complicated with keys of other languages
i'm comparing keycodes, not strings
well yeah, you do you
How can I get the touchId using TouchControls actions ?
Hello! I have a specific problem that I was hoping to get some ideas on how to solve. I teach game development and my “Hello World” is an FPS using the FPS AIO Plugin. One of my students this spring is quadriplegic, and requires the virtual keyboard to type. However, when you hit play in Unity, the mouse focus goes straight to the game. In order to bring up the virtual keyboard, my student has to defocus their mouse, making the virtual keyboard useless in editor. My student has the use of three mouse buttons and they can move the mouse around the screen using their wheelchair joystick. Any ideas how I can get my student engaged in the course material and with Unity? I’m at a state school and accessibility is crucially important to my curriculum, so if I can’t get this solved through technology, I’ll have to do some very quick and deep thinking on how to alter my assignments to meet my students’ needs or write some sort of plugin. I also don’t really think it’s necessarily fair to limit them to curriculum based on a technology issue since this really just has to do with virtual keyboard interfacing with unity.
someone messaged me an answer to this question, I thought I'd leave an answer. Cursor.Lockstate was taking over the virtual keyboard. Remove or comment it out, and the V-keyboard will work.
Hi does anyone know how to make a melee and jump buttons with the new input system?
@void relic you can use Win32 API's to refocus the mouse.
^ also Cursor.lockstate too 🙂 if you need more than that feel free and DM me too! Accessibility and teaching are both near and dear to my heart.
Thanks! I also like to design for accessibility, it just hadn't occurred to me what could effect the windows keyboard, so we're trouble shooting. The keys are worknig, but we're trying to get it in a good position so that the Mouse Look doesnt leave them staring at the ceiling or floor by the time their mouse reaches their V-Keyboard 🙂
for sure 🙂 Also definitely take a look at the Tobii Eye Tracker for input stuff
How do i trigger an input while the right trigger on my controller is held down? (old input system)
if(Input.GetAxis("WhateverYourRightTriggerAxisIs") > 0){
if(Input.GetButtonDown("WhateverYourButtonIs")){
//Do the thing
}
}
thanks
Hi. Can someone help me with a problem that I'm having with the Player Input?
For some weird reason, the player input don't call my OnControlsChanged event :/
This is how my player input is set up
And my code (I've also tried putting the playerInput variable as a parameter and it has the same problem)
It only calls when I recompile the code and enter PlayMode, but anytime after that that I try to change controls, it doesn't
@stark orchid When do you want this function to fire?
Basically I want to make my character aim at my mouse/direction I'm pointing with the right stick on the gamepad. The simplest way I find to do this is to have different inputs for the mouse and the gamepad and switch the current one when I change the input device being used on
That's why I need to use OnControlsChanged (which is a default function callback from PlayerInput) to work, because since the default inputMode is InputMode.Mouse, the right stick don't work when this bug happens
I've tried putting both input devices on the same action, but it didn't work to me
Oh okay. So you would need to call this function after, for example, a mouse wiggle. I've not done that before, But I imagine it would look something like this:
You'd want to change from "SendMessages" to Invoke Unity Events.
And then you'd want to fire that function when that action happens.
The way I've setted up the actions is like this
ahuh. That looks alright.
You should be able to also do it with SendMessages, but, I don't know how.
Honestly, I've used the Invoke UnityEvents and I didn't liked compared to SendMessages. And since it calls back when I recompile the code it clearly works just by using the SendMessages
Yeah, You should be able to do it that way. SendMessages, as I'm sure you've heard, is slower and sometimes don't fire correctly, but they are easier to use. imo.
Hello I'm having an issue using the touchId, when I first touch my screen touchId starts at 0 and then goes to 1 even before I release my mouse (Touch 0 start > Touch 0 move > Touch 1 move > Touch 1 end)
Other touches after the first touch work correctly (Touch x start > Touch x move > Touch x end)
Any idea why this is happening ? Is it because of touchScreen simulation ?
"The name of type or namespace InputSystem doesnt exists in the namespace unityengine (are you without a assembly reference?)"
Are you using assembly definitions @umbral sluice ?
whats that
Ok so probably not then
unless you did it by accident
Do you have that error in Unity, or just in your IDE?
unity
also one time that i was installing and re-installing the package
it appeared an error
@austere grotto
actually
only in the ide||the ide is the script editor, right???||
how do i get the axisraw with the new input system?
i need it for a movement script https://hatebin.com/kjfpsqllec
@umbral sluice input is generally Raw until you add a Processor to it w/ the new system.
there are some default deadzones applied in InputSystem preferences (edit -> project settings, etc)
you can setup Actions, or you can access devices directly ie:
Gamepad.current.LeftStick
etc
@west oracle i didnt understand
I'm making jumping in my 3D game with the new input system, and I'm wondering what binding or whatever it's called I need to add. Do I add a binding, a 1d axis composite, or a 2d vector composite?
@west oracle in your videos, you explain how to make a character controller, not how to get the rawaxis
its already "raw" unless you add a Processor
if you want the bytes coming back from the controller you can get that too
i think u didnt understand
i already have a controller
but it uses the Input.GetAxisRaw function
and i need to use the new input system for some more advanced stuff
In the new input system you use InputActions and listen for their started/performed/cancelled events
or poll them with myInputAction.ReadValue<sometype>()
like readvalue<horizontal/vertical>?
ye
but then its not especified what float it will read
or oftentimes you put both horizontal/vertical on the same InputAction
and do ReadValue<Vector2>()
ill make 2 floats and if i press w/s the 1st float will be 1/-1 and a/d the 2nd one will be 1/-1
I'm making jumping in my 3D game with the new input system, and I'm wondering what binding or whatever it's called I need to add. Do I add a binding, a 1d axis composite, or a 2d vector composite?
@austere grotto Thanks for the response, but what type of composite binding would that be? Binding, 1D axis, 2D vector, Button with one modifier, or Button with two modifiers? Sorry if this is a dumb question, but I'm new to the input system.
Just a regular binding @heavy dome
how do i get the current input scheme through the generated c # class
^ very good question. this is one of the reasons i've completely abandoned Generated C# Class checkbox.
along with not supportign PlayerInput component AT ALL
Why my game pressing d while iam not pressing d?????
is this where i ask about UI ?
is there a way to access the users clip board on webgl, ive seen some solutions that use an input field, but i would rather it just be able to be bound to a key
eg you press "c" and it copies the arbitrary string "hi" to your keyboard, or you can press "v" and it saves the users clipboard to a variable
after messing around i found i could use GUIUtility.systemCopyBuffer, which while it can save to a clipboard, this clipboard is only accessable from the game itself, and cant access the clipboard of the user
i found some code on the internets that seemingly does what i need!
how do i set up an input button
for some reason my jump input isnt working
here is my main movement and jump script here
looking at jump now should my gravity be that high
GetKeyDown in FixedUpdate is a no-no
GetKeyDown only returns true for the exact frame during which the button is pressed
FixedUpdate does not run every frame
It only runs according to the physics update timestep.
The normal way to deal with this is to capture the input in Update(), store it in a variable, and consume it in FixedUpdate
yep, that's a script
so from what I have gathered getkeydown should be under standard void update
yes, it should be in the Update method
you should create another bool variable to record when the player presses the button
and in FixedUpdate, check that variable. If it's true, do the jump and set the variable to false
public bool onKeyPress for example?
doesn't need to be public but sure
can probably be private
probably - you would't want any other scripts messing around with it.
I believe I should set it to false initially then register it as true on press
yeah that makes sesne
just make sure you set it false again when you do the jump in FixedUpdate, or you will keep jumping each frame.
You may also want to only set it to true if playerOnTheGround is also true at the time the player presses the button - basically the same condition you have now on line 37 in the hatebin
player on ground is true at start
onkeypress is false on start because thats assuming you dont press anything right away
mhmm
You could just leave that false as well and just allow the OnTriggerENter to set it when necessary
That could be useful in case you have a level where the player starts in the air for example
¯_(ツ)_/¯
so perhaps in private bool I could do onKeyPress= false if playerOnGround is true
@austere grotto https://hatebin.com/swyrsemczp Okay I think I got something going here
bug on line 44
Should be == instead of =
also you don't need line 46 (it doesn't do anything)
And you should move line 32 to inside the if statement on line 44
Do you mean for your jump vector to be on the Z axis instead of the Y axis?
jump = new Vector3(0.0f, 0.0f, 2.0f);
Usually "y" is up, but I don't want to assume anything about your game
Bigger problem: you're not setting onKeyPress to true inside the Update input check
in this case z is up due to the orientation of the model
well it definitely works now but now I end up flying off into space
You're probably not setting onKeyPress back to false when you do the jump in FixedUpdate
something like that - something not being reset properly
probably have to make an if onkeypress is false line or something
hey, do new input system (and to make it more precise - Multiplayer event system) have a problem with selecting buttons?
my button is selected by default (and all move events work perfectly) but it has a "Normal Color" instead of "Selected Color"
If I navigate down and back to it it is correctly selected (with proper color)
Anytime I try starting a project on unity this happens
well it gets stuck there
Oh. My vpn was causing the problem....... HOW
Another thing, my controller has an access to corresponding player's PlayerInput. What's the easiest/clean way to register listener to this PlayerInput map events? playerInput.onActionTriggered listens to all events so I have to do ugly filtering. Can I somehow get my PlayerControls (InputAction) from it and register listeners with strong typed references?
hi, how do i make one thing happen when a button is pressed, and make ANOTHER thing happen when it's released?
Hey, you should use IPointerDownHandler and IPointerUpHandler
using UnityEngine.EventSystems;
public class Test : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public void OnPointerDown(PointerEventData eventData)
{
//Button is pressed...
}
public void OnPointerUp(PointerEventData eventData)
{
//Button is released...
}
}
thank you! how do i set these up in the input actions?
You can use UnityEvent for when you press and release
https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html
using UnityEngine.EventSystems;
public class Test : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
[serializedField] UnityEvent onPointerDown;
[serializedField] UnityEvent onPointerUp;
public void OnPointerDown(PointerEventData eventData)
{
onPointerDown?.Invoke();
}
public void OnPointerUp(PointerEventData eventData)
{
onPointerUp?.Invoke();
}
}
You can even override and only accept functions that has certain argument(s)
https://docs.unity3d.com/ScriptReference/Events.UnityEvent_1.html
I haven't really used Input Actions, so I can't really help you there unfortunately, but if you attach the above script to a UI element that should do the trick
I prefer to react to the started event
MyInput.Player.MainAction.started += event => Shoot()
And then the .cancelled for release
thank you
where do i add this
also what does this mean
are they all called when i do OnA()?
i dont know. i dont really get unity all too much, im very new to it
in the new input system a press on the keyboard spawns 2 events, how do you filter so that only buttonDown is triggering an event?
like this, which doesn't work
It creates 3 actually
Started, performed, abd cancelled
You just need to pick one to listen to and ignore the others
No need to add any interactions
Ig you want only buttonDown the equivalent in Input System is to just listen for the started event.
how would i make a UI button do horizontal and vertical input like with the WASD and arrow keys?
thing is I use PlayerInput which only listens to the event with a context, i could filter out context but i'd like to keep things super simple so I'd rather filter at the action level
so what combination of interactions do I add to get Down?
might need a custom interaction
god damn! this documentation is full of typos, nothing's working
Hi. Is it possible to handle phone vibration with Input System? Or still need a custom implementation?
I'm creating a local multiplayer. I have InputActionAsset called PlayerControls. My player object has PlayerInput component with my PlayerControls referenced. My other UI controller has reference to exact player's PlayerInput. Can I somehow extract PlayerControls from PlayerInput and add strongly typed listener to exact events? atm I can do playerInput.onActionTriggered += myListener; and then filter out context but it feels really bad
Is there any way to simulate more than 1 touch with the Simulated TouchScreen option ?
You can do something like playerInput.currentActionMap["up"].started += SomeFunction;
Try out the generated C# file strategy to see if it's more to your liking
You can also try like what I just suggested to elenfantopia
Input System gives you a lot of options
@austere grotto solution with currentActionMap worked playerInput.currentActionMap[PlayerControls.Player.Cancel.name].performed += OnCancel; but it still forces me to create a new instance of PlayerControls to have an access to the Player (and Cancel and its name) field 😦
This seems to be an overkill 😅
playerInput.currentActionMap[PlayerControls.Player.Cancel.name].performed += OnCancel;
PlayerControls.Dispose();
Can someone help me understand the new Input System? Using 2020.2.0f1 version and got basic movement with translate down on player game object in a new unity scene with rigidbodies, but I can't figure out how to setup basic camera controls with the new input system.
I'm using the default action map created from the player input component asset.
Create Input Actions for each "control" you want. Like say you want to be able to Pan, Roll, and Zoom your camera
Create a Pan Action in your input asset
create binding(s) for it
then in your code listen to the Pan action - and pan your camera
likewise for roll and zoom
The default already got bindings for it.
I just want he basic move camera with right stick functionality.
Ok so you just need to hook up your code to listen to events on the Look action
how did you do it for the movement?
Just do something similar but with Look instead of move
Is it put in code that is connected to the player or camera?
Up to you - I would most likely attach it to the camera since that's what the code is controlling
Can't seem to invoke the OnLook event.
Sorry also got an object with onmove connected to it, trying to make own third person system using the new input system. Got the camera and player objects separate.
So I think i'm interpreting the new input system wrong as I have almost no experience with it.
I got the player input component on the player and a script to move that object on it, but on camera its just the script, would I need multiple player input components to get this work?
new inpout system on two onbjects ubity
I was trying to avoid using cinemachine to not bloat load learn my brain the various new thing I never touched before. Cause I want to learn more about the component's functions.
You can put a reference to the same PlayerInput object on the camera
Just make a public field and drag it in
has anyone succesfully made a custom interaction? mine keeps erroring that it's deregistered, each time i launch unity
hello, friends
are these all the appropriate inputs for a ship that can move, roll, etc?
are there any particular settings/options I should consider checking or configuring?
For now I've given up and am using combo of the new input system and the Cinemachine camera system to make a basic third person camera+control system.
Anyone familiar with https://assetstore.unity.com/packages/tools/input-management/joystick-pack-107631 having the joystick freeze in whatever direction when using a box collider as a trigger to teleport to a new zone using SceneManager.LoadScene(levelToLoad); I've also tried Aysnch and ran into this issue. I am preserving (DontDestroyOnLoad) the canvas, and player object through scene loads.
Hey all, question on the new input system. I have a card game asset I’m going to sell on the Unity Asset Store and need to have both mouse and touch input. Can’t use 3rd party input since I’m selling it, so I’m trying to figure out how to make this work. I could use the new Input System but wouldn’t that force the people that buy my asset to use the Input System whether they want to or not?
So I’m deciding between:
- Use the UI system which has built-in touch controls (but the UI system has a LOT of limitations and you couldn’t make a game like Hearthstone with it)
- Use the new Input System (but would possibly force whoever buys my asset to use the new Input System whether they want to or not)
- Is there an “old” version of combined mouse/touch input? I’m pretty sure it’s been deprectated, so if that’s the case then I’m stuck with options 1 or 2.
future looking though, I recommend using the new InputSystem
there wouldn't be a problem using both with compiler directives, but its always ugly to do that kinda thing
Thanks, I’ll check out that simulateMouseWithTouches as a possibility. But ideally I’d love to be able to use the new Unity Input System, only I’ve run into issues before with it not being 100% feature complete yet, still has some compatibility issues, and asset store users might not like that it’s forced on them.
Is the current state of the Input System pretty stable and feature complete? I tried it a few months back and it seemed close but still not quite there yet.
its a little better. mobile dev with it is hot garbage though.
no Unity Remote support yet AFAIK
Ugh
the touch inputs WORK on all devices, but holyfuck is it obnoxious to not have Unity Remote
i got on ReneDamm's case about it a few months ago
Haha ok good to know
What about compatibility with the old input. If I sell it on the asset store would it “force” users into the new Input System or could they use both the new and old Input at the same time?
In other words, will the old Input.GetKeyDown() still work if the new Input System package is installed?
you can set the input mode to "Both"
instead of one or th eother
but Keyboard.current[KeyCode].wasPressedThisFrame works well too
so a single property with a compiler directive would keep you safe there
TL;DR if they're using new InputSystem at all you should default to using that
but if its not present, fallback
https://docs.unity3d.com/Manual/PlatformDependentCompilation.html (in case you aren't too familiar w/ compiler directives)
ENABLE_INPUT_SYSTEM
ENABLE_LEGACY_INPUT_MANAGER
specifically these two
OK that seems promising. I’m cautious because I’ve been burnt so many time before by trying out one of Unity’s hyped up new and exciting features!! ...only to find out it isn’t fully functional so you and up losing countless hours, scrapping it and going back to the old way. Keeping my fingers crossed
i did a big ol' series on InputSystem from coder perspective
Awesome, this looks like some good content. I’ve saved it to dive into later today
Any major “gotchas” or hidden land mines or roadblocks I should be aware of before diving into the Input System?
Unity Remote's the big one
as well as the "Generate C# Class" checkbox
InputSystem has 3 paradigms to use Actions and none of them play well with eachother
ie: Generate C# Class doesn't understand what PlayerInput is
so Local Multiplayer ( 4 controllers for ex) is not practical/possible with Generate C# Class
(if you need that, ping me :P)
and two, the default behaviour for anything Action related is "OnDown" only. You dont get OnUp unless you ask for it.
Of the 3 paradigms, which would you recommend for a card game (drag/drop)
Generate C# Class is fine if you only have 1 "User"
OK, but I’m also planning to add in multiplayer. Would that still work?
same device multiplayer on a touch screen would be fine
really only comes into play if you havev more than one physical input device
It would be separate devices / screens. Kinda like Hearthstone
ya - ur still good w/ Generate C# Class
OK cool, I’m going to give it a whirl. Appreciate all the info amigo!
👍
New code: Using input manager
Old code: Using hard coded controls
I'm having an issue using the input manager to replace keybindings in my game.
Originally I had hardcoded the keys used for menus into the scripts that controlled them. I wanted to allow the player to switch the controls in an options menu, but to do that I need to switch the controls over to the input manager. Now my menus will scroll all the way to the top or bottom with each key press, instead of just moving up or down one space.
How can I get the Touch ID of every touch that happens on the screen without knowing in advance the number of fingers that will touch it, wi th the new Input Actions system ?
I am trying to use the new Input System... and I can't seem to figure out when a button was released this frame. The phase is changing between InputActionPhase.Waiting and InputActionPhase.Started. What I want to know is the corresponding thing to the old Input.GetKeyUp polling behaviour....To be more specific I defined an Action with ActionType Button and I want to poll if the button corresponding to the Action was released this frame
Maybe it's worth looking into if you should subscribe to the .canceled event
@soft basin yeah i was trying to do it via polling though. My solution was to switch to the preview version of the input system (1.1 preview 2)
They added WasPressedThisFrame() and WasReleasedThisFrame() to the action.
This joystick issue is driving me insane. I've yet to figure out what im doing incorrectly.
It's getting stuck in position and no longer updating or responding. (as seen in img1 below)
as far as I am aware all the gameObjects (The Canvas which my Joystick is on, and the Player which is reading that Joystick object) should be persisting through SceneManager.LoadSceneAsync(levelToLoad); i've used asynch and synch both and the issue is still apparent with both
i can reliably repro this by moving my player through a teleportation boxcollider2d (istrigger) and then the load new level script that's attached to it, is as follows
{
if(other.gameObject.name == "Player")
{
thePlayer.canMove = false;
thePlayer.joystick.gameObject.SetActive(false); // attempted fix
//SceneManager.LoadScene(levelToLoad);
SceneManager.LoadSceneAsync(levelToLoad);
thePlayer.canMove = true;
thePlayer.joystick.gameObject.SetActive(true); // attempted fix
thePlayer.startPoint = exitPoint;
}
}```
so theoretically i should be disabling the joystick before the load happens and then reloading it. but it seems this is not occurring (Note: that was an attempted fix )
img1
Upon further inspection it seems all my canvas buttons / ui elements are going "unresponsive when i zone...! lol.
at least to input by the player
Turns out i needed to make sure my Event System Object was persisting as well..
Hey, I wanted to disable ui input and still receive "non-ui" events so I made playerInput.uiInputModule = null but it throw errors. Is there any workaround? Having a reference to dummy uiinputmodule and setting it when I don't want any ui set?
idk if this has already been asked, but how do i make it so it recognises me holding my button down?
like it's def the "value" action type, but i cant figure it out how to do it for one key bind
Do you mean do some continuous action while the button is held, or do an action only after the button has been held down for some amount of time?
first option
Also, either way - you can do it with a Button action
like GetButton
Usually you listen for the started event and the cancelled event
set a bool to true in started
set it to false in cancelled
use the bool in Update()
np
or actually, i might need some more help with this. i'm not so well experienced with buttons using the new input system (only vector 2 composites)
like setting it up and whatnot
edit: i might be on to something, so nvm. thanks again 
Edit 2: it works perfectly
Hi, I’m pretty new to unity and I want to implement FPS mobile controls, but I don’t know how, can someone help me?
how can I move InputPlayer.uiInputModule from one ui to another 😦
@uncut crater that can actually be a bit tough 😦 especially if you're trying to use the Automatic Navigation stuff.
is the context "Local Multiplayer" ?
@west oracle I thought about something like small UIs that popup for a player. For example when he uses an inventory chest there would popup a small UI where he can choose an item. I thought this would be as easy as taking that player's PlayerInput and pointing it at that UI's uiModule
I actually wrote a tutorial on this exact topic but I hated how quirky the MultiplayerEventSystem was I didn't publish it
yes it is.
I came up with this problem pretty early. I have a player setup scene where players can press a button and join a game (small panel shows up for them). It is working flawlessly. Players can hit ready and when all players are ready there is a countdown and players are spawned on second scene. First thing was I wanted to disable ui input when player hit Ready. Problem is I wanted this countdown to be interuptable(?) if player pressed Cancel input. So I couldn't just Disable input - I had to disable it only for character setup panel (current panel where player hit Ready) so I could still listen for Cancel input in code to Unready the player and give him back the access to ui.
but basically the biggest issue is that these actions must be referenced/subscribed/initialized by the input module itself when you switch users
lol yep - it can be a bit tricky
so along with InputPlayer.uiInputModule = anotherUiModule I would have to somehow reinitialize inputs?
yea, because its all subscription based
worse yet when you disable that UI it'll actually disable that whole asset
so you have to be sure you dont shoot yourself in the foot
(I'm not sure if they repaired that in 1.02)
this conversation is a good execuse for me to explore this again tho 😛
so mebbe later today
so if I encountered these problems so early on I guess it won't get easier later on if I want to introduce small UIs (like that chest one) 😄
Hello, I'm having a pretty annoying problem..
I'm making a local versus game and on start, a Player Input Manager (component ) spawn one GO per players connected ( left screen. Gamepad + Keyboard and mouse ).
The players have multiple scripts who needs to be called at start in reference of the Player Input Handler script.
But if you look at the inspector, the index of the player and the Mover var are good unlike the skills Projectiles and Skills who are called by the other player.
So if P1 want to open fire, P2 open fire ( oc it's the invert on the second ---Player Input GO.
What could i do please ?
Hi,
I recently switched my project over to the new Input system. I use the auto-generated C# script to reference it and to enable / disable my player inputs. This works well and i like the modularity of the system a lot.
However, in addition I control a freelook camera with a separate action from the same action map - for this I use the ready-to-use Cinemachine Input Provider and select my action as a reference.
However, if I disable the action map containing the camera controls action, it won't disable and I can still move the freelook camera.
Why does the action not disable with the rest of the the action map?
Hi, i need to make a simple movement code, can anyone help?
@gilded dirge You can watch this serie 😉 https://www.youtube.com/watch?v=gdp-O6z8x28&ab_channel=SebastianGraves
The introduction video to the 3rd Person controller series, in this video we discuss the features the series will implement!
► JOIN OUR DISCORD
https://discord.gg/jzmEVx5
► SUPPORT ME ON PATREON!
http://www.patreon.com/SebastianGraves
► FOLLOW ME IN INSTAGRAM!
https://www.instagram.com/tragicallycanadian/
► FOR FREELANCE INQUIRIES E-MA...
Thanks
Do anyone have also a code to pick objects?
i mean right click and pick the object untill i stoph pushing righ click
Just solved my problem OMG !!! 
The problem was due to a search priority of each scripts on each players
So what i did : create List of each scripts of each players
Convert them into another new variables => Array[] ( the problem occured because of the array ( start at size = 0 and can't add my scripts ===> List.AddRange()
Then tell what the Player Input will control with the right index
I think that the documentation of the new Input System should be more documented and may be show more situations
PC stand-alone build, Input System, URP, and TMP_Input not working. In editor everything works just fine. But in build it doesn’t. No errors or nothing.
Looked online, no solution found. Suspect it might be because I put system is enabling touch support, which I don’t need, and the touch support is conflicting with the way input fields work?
Also, is there a performance penalty for setting Active Input Handling to Both?
how can i check if a button pressed only for this frame with new input system
i want to make a value 1 only for 1 frame
huh
but it is action not key press
i mean something like old input systems getkeydown
when key is pressed value becomes 1 for 1 frame
and than becomes 0 until player releases button and presses it again
so when you press it it goes up and 1 frame later its back again?
no i mean with new input system
i just started learning new input system 1 day ago
so i am not really good at it
is there a way i can make that value from that tab
for games controls to be portable
listen for the started event on your InputAction.
Uh, for InputSystem users question, can you rate is it ready for commercial use or not yet?
“Jump”, it pressed, set a bool jumpRequested to true. When released, set to false. Then anytime you can check if(jumpRequested) DoIt(now)!!!
no it is something different
inputmanager spams making it true
as long as key is holded
so it will still spam jump
but it will work to stop jump
ill check praterblues and aburrons solutions
thanks for help tho
if they dont work ill try that
actually prolly i can make 2 bools
1 gets enabledd when value is 0
other one gets disabled when space key is pressed
well my brain died from that simple algorithm and i cant continue it now
damn
Hey y'all. I'm testing out the new input system and it breaks at low timeScales. In particular it misses click events on our pause screen (as that's where we set the timeScale to .001). Is there a workaround for this?
I have the events set to process in FixedUpdate (which must be the source of the issue). So I guess I'll have to process input events manually so I can handle the case when the game is paused.
@sharp juniper FixedUpdate respects TIme Scale.
When I "pause game" and am using InputSystem in FixedUpdate I switch it to Update or Manual
working as intended
(there is no problem changing the mode at runtime)
Hey all! I'm working on a co-op xbox game using the new input system. My game is a top down 'bullet hell' style game. My issue is when I try to aim the barrel of my gun, both players override the other. I cant figure out how to separate them out
here's the void I am using for rotations:
{
playerInput.Movement.MovementRightStick.performed += ctx =>
{
currentMovement = ctx.ReadValue<Vector2>();
movementPressed = currentMovement.x != 0 || currentMovement.y != 0;
};
Vector3 currentPos = barrel.transform.position;
Vector3 newPos = new Vector3(currentMovement.x, 0, currentMovement.y);
Vector3 posToLookAt = currentPos + newPos;
barrel.transform.LookAt(posToLookAt);
}```
this matches the player input controller for send messages
Does anyone know how to implement A Sprint Animation with the new Input system. I am pretty new found close to nothing on that one
Those are two different questions
Are you just asking "How can I detect when a button is pressed and when it is released?"
that's the input-related part
Well...both lol
- the player should Sprint for the duration the button "Shift" is being pressed
Does anyone have any best practices around UIs and using the PlayerInput/PlayerInputManager system?
i.e. is it better to create a single UI that all players use, or for each player to create their own unique UI for local MP
Depends on if you want them trampling on each other or not
You can give them their own UIs and their own Input Modules
Input Module is the piece that will map a particular UI/Event system to a particular PlayerInput
@tame oracle (this was an example made for @uncut crater 's usecase the other day). Each "Crate/Chest has its own UI Canvas that players interact with, and MultiplayerEventSystem interacts with them
Is there a tutorial or example or something for using the new input system with the new UI package? I'm new to both, and while I can get input events to my own class, and I HAD the UI system generating events (EG: Button was pressed) with the old input system... I don't get any such events since installing the new input. I'm sure I've just configured something incorrectly, but I'm not finding a lot of documentation on combining the two.
that mapping comes from an Input Module
in the old input system there was the StandaloneInputModule
In the new one you need an InputSystemInputModule or whatever it's called
Yeah, I have an "Input System UI Input Module" component which seems like it's meant to do this, but it's as if it receives none of the events. Nothing I've done gets any reaction from it. But if I use the PLayer Input thing and send test events to methods of my own they do fire. So I know the input system seems to be working itself.
Do I need to directly link the relevant events from the Player Input component to the Input System UI Input Module (what a mouthful) component in its "Events" config?
this is what mine looks like
you need to populate all those fields with events from the input system for it to work
(those were all there by default for me)
Those actions are all from the Actions Asset which is specified there - the DefaultInputActions asset
if you use your own asset you will need to create events to put in all those places
Yeah, they started that way, I tried making my own Input Actions thing though, and the option to go back and see what the "Default" looks like is gone, because "DefaultInputActions" isn't there now
Well there's a screenshot for you
al;so the Default one can be found in Packages/Input System/InputSystem/Plugins/PlayerInput
Ok, thanks, I'll play with it some more
If you open that asset you can see how they defined all those actions that they're using in the input module
Conceptually, I assume "Left click" corresponds to "Pushed button"? I sort of expected the names of the fields to be more "Here's what happens" than "What was pressed"
Honestly I'm not sure
Like, for a mouse you move the mouse to point at a button, then click on it (probably left mouse, but even this isn't a GIVEN for say, lefties). To do the same with a controller (assuming it's not also driving a cursor) you'd highlight the button and press like, "A"
Yeah it's named poorly I think
So I EXPECTED the UI system to have events like "Activate Element" that are more generic. Since that seems to be the philosophy that the Input system is going for by defining actions with different underlying activation methods
Yeah I think the InputSystemInputModule has just named things poorly, in a PC-Keyboard-Mouse-centric way for some reason
nod Helps to hear that's the case and not that I'm just missing something 🙂
It's possible I'm just also missing something though 😄
haha, will keep it in mind 🙂
Hrm. Dragging the default one to copy it elsewhere seems to have been a Bad Idea(TM) as it's been pinwheeling for several minutes straight now.
uh oh lol
unity doesn't really like it if you modify anything from the Packages directory
as all of that stuff actually lives in the package cache and not in the project itself
it's all temporary files
Right, that's why I (intended?) to copy it before mucking with it
It had a big green plus sign icon so I don't THINK I moved it 🙂
ah ok you duped it then tried to move?
It moves by default from my own assets, but appears to copy by default from packages
ok
No, I just duped it and it went to la-la land
And finally recovered with no messages. So uh... OK?
It really did make a copy too. Renaming the copy does the same extended pinwheeling.
That's odd. I'm scared to try it now 🙂
Moving it seems fine though. shrug
Ok, I'm going to try to get basics working with the defaults, which really seem to cover all the events right now anyway. I shoulda just done this in the first place lol
¯_(ツ)_/¯
I feel like I actually learned a little about Input System trying to answer your questions here
WEll that's good 🙂
like I didn't realize Unity had their own little default Input Actions asset that is used by the input module
I wasn't really sure where those actions came from before
That IS why I usually attempt to start from scratch with new stuff, at least, if I think I understood the docs. I usually end up learning exactly what I didn't REALLY understand
And, nothing works with the defaults either.
There must be some linkage step between the UI stuff and the Input system I'm missing
Yes
I was pretty sure the input module was that linkage
Yeah, but like, the Input Module doesn't have an output? Like, WHAT UI Element is it routing things to?
Maaybe I've ended up with a weird way of creating the UI in the first place. Since I have no experience with either of these things 🙂
I;ve got a UIDocument component here, but nothing seems to tie the Input stuff to that.
Ok so
confessing my ignorance
I've never used UIElements
only UGUI
and I know Input Module works for UGUI stuff
I have no idea how UIElements works
Me either 🙂