Input System Action Types Explained | Value, Passthrough, Button - Unity
Вставка
- Опубліковано 1 сер 2024
- This video goes over the difference action types in the new input system for unity, specifically the value, button, and passthrough types. I explain each in depth and go over event callbacks and interactions.
There are three action types with the current input system, Value, Button, and Passthrough.
ᐅGet the full Source Code Bundle to my Unity Tutorials 🤓
sam-yam.itch.io/samyam-full-s...
🔗 Relevant Video Links 🔗
ᐅInput System Github Doc
github.com/Unity-Technologies...
ᐅEnum InputActionType:
docs.unity3d.com/Packages/com...
ᐅDisambiguation:
docs.unity3d.com/Packages/com...
Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help me fund my development projects while recommending great assets!
😎 Cool Unity Assets 😎
ᐅPeek - Editor Toolkit: assetstore.unity.com/packages...
ᐅEditor Console Pro: assetstore.unity.com/packages...
ᐅRainbow Folders 2: assetstore.unity.com/packages...
🤝 Support Me 🤝
Patreon: / samyg
Donate: ko-fi.com/samyam
⏱️ Timestamps ⏱️
0:00 Intro
0:22 Action Types Overview
1:06 Event Callbacks
1:54 Interactions
3:26 Value
5:40 Initial State Check
6:52 Button
8:28 Passthrough
10:02 Value vs Passthrough
10:44 Outro
💖💖THANK YOU TO ALL MY PATRONS 💖💖
❯❯❯ My Links ❮❮❮
💗 Patreon 💗
/ samyg
💬 Discord Server 💬
/ discord
🐦 Twitter 🐦
/ samyam_utube
📚 Facebook 📚
/ samyam.youtube
🎵 Music 🎵
*Acid Trumpet by Kevin MacLeod
Link: incompetech.filmmusic.io/song...
License: filmmusic.io/standard-license
*Airport Lounge by Kevin MacLeod
Link: incompetech.filmmusic.io/song...
License: filmmusic.io/standard-license
👍 Like and Subscribe! 👍
🖥️ Computer Setup 🖥️
*As an Amazon Associate I earn from qualifying purchases.
www.amazon.com/shop/samyam
#madewithunity #gamedev #unity - Навчання та стиль
Just waiting for your channel to blow up. Everyone's main issues are with the input system and here you are with the best tutorials. Thanks.
Thank you so much :)
Yes, always great videos. You are my go-to for cinemachine primers and the new input systems. Really helps when your are bogged down in the DOTS stack, which is already a lot to learn.
Thanks! 🙂
Thank you! Cleared all my confusion in 10min. Simply amazing
Duude this video was so well made and edited, from the pleasing visuals to the BG music adjusted at the right volume. So underrated!!! :)
Glad you enjoyed it!! Thank you 😄
It was partly made in Canva and put together in the editing program :)
Thank you for this break down of these input types, I'm still brand new to Unity and I just ran into what was otherwise a confusing "tip" in the Unity editor itself
This was so needed... I always love your explanations and you really explained new input system in such an awesome manner. Really the lack of documentation and the clarity of stuff on the new input system docs have always thrown me off... Would definitely be waiting for the interactions video... Keep it up... :)
Thank you :)
Honestly, I'm blown away. This tutorial is amazing.
Thank you so much! :)
so many hours of googling and im happy this is where i ended up. Thanks!!
😄
Hey, thanks a ton for the in-depth videos on the new system. Currently switching over and it's been a certified Really Fun Time™
Glad I could help 😅😂
This is the kind of video i told you about! you are a beast! :D
simple, yet informative!
Awesome video series, saved me lots of time, thank you! 👏❤
Best series for new input system I have found, keep them coming
Thanks so much :) More videos on my channel!
You're a pure energy on UA-cam and Gamedev, thanks for upload videos
Thanks for watching 🙂
Why this channel is so underrated?
It’s growing pretty well! And thanks 🙂
This channel is fire. Thank you very much for helping us out!
🔥😂 Thank you!!
Best explanation, thanks so much :P
Very useful video! Thank you! Seems like you are already a master of the new input system keep going with videos about it, since, as you mentioned, the documentation is very confusing. Would be great to see about Interaction and Processors (maybe how to create a custom one).
Yes that’s my plan! But first I have to do the patron video :)
Very clear and concise information presented with nice visuals, thanks. This channel will explode soon.
Thanks so much! :)
Here from reddit, you're awesome!
Amazing video and amazing professionality.
Thank you!
Samyam and IHeartGameDev are easily my favorite new unity channels
🎉 awesome!
Thank you! My buddens are working now!
Hey, Thank you for the explanation, you did a fine job, Cheers!
Thanks!!
Thank you so much, you saved my day :)
Hey thanks, was really informative video : )
brillant video!
Thank you!!
Great video!
Thanks!
ty very much ,so it was before my eyes......
Thank You.
great video!
Thanks!!
Love your tutorial and your voice is so sweet!!!!!
Thanks!
Thank u ☺️
thank you
Wow it's the first actually helpful tutorial on the new input system. Thank you!
Edit: Oh you're not active anymore :( sadness
What do you mean not active? I post regularly 😄
@@samyam Oh I didn't realize! I was just looking at your home page and most of it is from like a year ago
Thanks, i was trying to make some checking when the player is trying to move or not, and using the passthrough was doing nothing, now I understand why
Thank you! This helped me to understand the input system better. although I still don't know how to do this: I want values that are 0 or 1, nothing in between even if using gamepad, I want to use the horizontal part of the joysticks or the kyeboard arrows. But the thing is, if I was pressing left and I press right without leaving the press of left, I want to ignore that input but the input system gives me the canceled InputActionState. I want to ignore the outcome if both buttons are pressed but I don't know how
Great videos, by far the best ones on the New Input System.
Just a quick question: how do I distinguish between presses on the HUD, and presses on the gameworld? Every click on a button triggers my FPS game to shoot (which uses Mouse1...). What is the pattern to avoid that?
Thank you!
You can check if the pointer is over the UI before firing:
docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.EventSystems.EventSystem.html#UnityEngine_EventSystems_EventSystem_IsPointerOverGameObject_System_Int32_
Great video as always! I just started posting a series about how to take manual control on the input system. The documentation as you say is really lacking!
Thanks! Yeah, hopefully it’ll be revamped in the future
Hello, can you explain to me how to combine inputs? I am making a simple camera rotation for my character but want it to only happen when I am right clicking and moving the mouse (at the same time). I heard I can do this with modifiers (the other approach would be having two different events, one for the mouse click and one for the rotation) but I cant figure it out
Here I briefly explain modifiers ua-cam.com/video/GyKBoDF_Oxo/v-deo.html which may help. Although if you have separate actions with the same controls it will unfortunately execute those actions as well. You could listen for the right click, then in that event Start a Coroutine that doesn't stop until the right click is lifted (use the StopCoroutine mthod). And in the coroutine you can keep track of the mouse delta. I use a similar way in my touch swiping tutorial ua-cam.com/video/XUx_QlJpd0M/v-deo.html
THANK YOU, that's exactly the information I wanted. Especially the chart at 3:11, how come unity doesn't just provide us with such details? ༼ つ ◕_◕ ༽つ
They do but it’s pretty hidden 😂 Had to search through the Github repo for a lot of this information
How can I tell how much pressure is being applied to the button when it is pressed? For example I need to know much pressure the player is using to determine the amount of force to add to a projectile.
Thanks
Man i need help with unity new input system. I have no idea how to detect on screen button pressed
For real, the documentation is so confusing and your videos are the only source I've been learning from.
Is it somehow possible to edit the documentation by you if you request Unity or something?
Who knows maybe one day! 😂
@@samyam Let's just hope, that day is soon enough XD
so how do you get values from the inputs-- on the script side?
nevermind, I found it. was missing the type definition in ReadValue
A tutorial on FPS where you can click on objects using interfaces (like buttons), and switch to cursor mode is my dream. All with the new input system by the way. For now i have a good tuto for the FPS controller, another tuto for interfaces, your tutos with the coins, but not the new method of "clicking" on objects via the camera, and not the skills to mix them all yet. Fingers crossed... ; )
I have a raycast video just for that
ua-cam.com/video/JID7YaHAtKA/v-deo.html
and it uses interfaces!
Also have an FPS Video
ua-cam.com/video/5n_hmqHdijM/v-deo.html
Don’t know what you mean by cursor mode, but I have a video for custom cursors here!
ua-cam.com/video/PTL19bXCsNU/v-deo.html
@@samyam I wasn't considering the cinemachine tuto, but now I think it will make the two others more understandable. Thank you Samyam 👍
Can you define what the stuff means on the left most column in the graph at 3:11
Hey, How would I cancel something if user touch &hold, but moved his finger while touching? Like for example, user touches and holds to object, but if he moves his finger a bit from first touch, it should cancel the action.
You can either do a check in your code, while the user is pressing down, check if the touch position has moved. Or perhaps you can make your own custom composite/modifier that checks it for you, but this way is a bit more work and not sure if it’s worth doing that much work for this case ua-cam.com/video/KXF3OR78iVY/v-deo.html
Or you can possibly use Unity’s event system interfaces like IDragHandler docs.unity3d.com/2018.1/Documentation/ScriptReference/EventSystems.IDragHandler.html
@@samyam Great! I was confused at first, So i created a press action with release only interaction. So when my press started, i calculate the touch, and when i release (performed) , i calculate the touch and i get the distance from them. That's how i achieved. I couldn't find anything like .moved like on old input. So i tried my best on "started" and "performed".
Any idea why if i use a "value" action type with a "button" control type, and click play, it automatically switched to an "any" control type, and "button" is gone for list? I thought i was understanding this, but I still cant seem to get the functionality i wanted.. just like the old "Input.GetButton" / "Input.GetButtonDown" / "Input.GetButtonUp"
Hm I don’t know why it would change to Any during play time, did you make sure to save the asset?
I have a video explaining Value, Button, and Passthrough here: ua-cam.com/video/DMUZfVSYJfs/v-deo.html
For those GetButtonUp and such you can add a Press interaction to the action and select the behavior (Release, which is on button up) and the action will be performed according to that behavior.
@@samyam lol yeah thats the video im commenting on rn... I have auto save enabled, and ive even disabled it, saved it, and then re-enabled it, and it still happens. Im following this video from board to bits about a better jump: ua-cam.com/video/7KiK0Aqtmzc/v-deo.html, and i can get it working fine with the old input system but i need both getting the button down and holding the button for that jump to work. and i cant seem to get it to work ive tried all the non-tapping interactions and i just cant get it.
@@samyam I figured it out! Its because i was handling all the jump movement in the function for the input. which is not good because alot of that is dependant on update, while the input system deals with events, as you said. so i had to move some of the logic into update and make the input function only handle the input.
Hey , can you tell me why player stuck in tile while jumping at edge in 2d platform game .
Please Reply, how to solve it?
Try adding a physics material to the tile to avoid getting stuck, and then in the material you can make the friction minimal, similar to this video
ua-cam.com/video/Yzp3veZ69R4/v-deo.html
@@samyam hey samyan I already tried 😢 but nothing happen , please help me , I build my game using bayat platform assets for playstore .please
Check how big your colliders are, you might be overlapping the friction one with the non friction one.
yessssssssssssssss
I don't press like on any video, but here's a comment to help with the ~~algorithm~~. Keep it up Sam! :)
Thank you!!
When I right click, create, and look all the way down I don't have an input actions setting. Could this be because I'm on 2d? I feel like that still isn't right or I did something wrong. Either way, I need to create movements and I want to start to learn and make my own games and have fun with it. Yeah, it's definitely not me cause I've re-watched that beginning part of the video many times and all I'm suppose to do is right click, create, and click input actions at the bottom but, the last thing at the bottom is Terrain layer. :(
Shouldn’t matter for 2D, make sure you have the input system installed in the package manager (unity registry). What unity version are you using and input system version?
@@samyam I just got Unity and I'm using 2020.3 12
@@samyam I probably didn't install the input system
@@samyam I don't really know how to do anything sadly
I have a mini series for Unity beginners if you’re interested
ua-cam.com/play/PLKUARkaoYQT178f_Y3wcSIFiViW8vixL4.html
Wow
wow
This may be what I need, ima watch. Still stuck on when you let a button go the action being performed stops.. so let's see if the answer is here 🤔 🧐👀👀
can you doa vide where a joystick dose anaimation
I have a video on animator scripting
ua-cam.com/video/3Ad1wr3qBRw/v-deo.html
Which isn’t exactly what you are looking for but basically in the script depending on your input you can play an animation or switch to another one. If you’d like smooth running, between walking and sprinting, then you can use blend trees to blend between them. ua-cam.com/video/m8rGyoStfgQ/v-deo.html
In my next next video I’ll be showing some animation scripting as well.
Can you tell me , how to respawn player on checkpoint with reduce health like -1 on each attack in unity 2d
Please Answer me..Please .Please.
Well when the player dies, you can either have a static variable (doesn’t reset in the script when the scene is loaded again) or keep track of the variable in a Do Not Destroy script. Or even better, don’t reload the entire scene and just teleport the player back to the start line and decrease their health in the script.
@@samyam can you provide me link of some examples of code .
Sure, blackthornprod has one on hearts:
ua-cam.com/video/3uyolYVsiWc/v-deo.html
But you’ll have to change it a little if you want the player to start over every time a heart is lost. But if should be simple just mostly changing the position of the player once a heart is lost.
@@samyam Thank You😊🇮🇳
You spelled Buddon wrong in the title. Good video!
😵
Hi. Can u make drag and shoot system like soccer stars game. Plz
Hey! It’s not currently in my plans but that’s a good idea! In the meanwhile here’s someone else’s video you might find useful: ua-cam.com/video/Tsha7rp58LI/v-deo.html
this confining the only thing i want is wean i move my stick to reading the value and depending on the Value the player to move slowly or fast for example if the stick is in position 0.5 to moved the player with half speed and wean the position is 1 for example to move the player with full speed
basically im try to understand how axis works on the new unity Input System my game have controller and keyboard and mouse support it is very important for my the player movement to work correctly
If you are using Keyboard you’ll have to smooth the values manually, I have a video that may help you:
How to get smooth movement in Unity’s Inout System
ua-cam.com/video/krA-B8yItc0/v-deo.html
@@samyam i know how to add input like keywords and button the question is how to add the sticks who have multiple values on the controllers ther is same actions that have more then 2 value the stics and trigger axis for example i want to know how to implement those axis in my game and do what i want with the code
for example if make i camera movement i want wean the player move the right stick to have different speed depending for how far the stick are for the center this how the work unlike other buttons the having 0 and 1 stick is axis and have multiple values and I want to understand how to implement the axis system in the new input system with the event method
i talked about convert new input system to old Input.getkey(), down and up
i found this: Mouse.current.leftbutton.wasPressedThisFrame;. it works but not good i wanna make it on InputActionMap. thats what i asking from u :D
Ah okay, if you want it to use events you can use the callbacks I mentioned to subscribe to the event.
github.com/Unity-Technologies/InputSystem/blob/bcc89c252897385f1adb8e3fc320e7a7c442862b/Packages/com.unity.inputsystem/Documentation~/Interactions.md
@@samyam thank you. i tried it before but i failed cuz there is no While-Press interaction (similar to Input.GetButton()) ,interaction there is (pressOnly,releaseOnly and PressRelease) and double tap , tap and press are not worked maybe i must be mistaken.
If you read the value directly from the action you’ll know if it’s pressed
action.ReadValue()
@@samyam i see 😊
3:10 As she says in the next video of the "Unity's NEW Input System" list of videos, this is actually quite a bad graph, you should check out the next video to understand it. The main point of confusion is probably that second value in the top left. We all assume it means the button press value that has to be crossed for it to be considered "released" but that completely messes up the graph. Like how the press value never seems to even reach over 0.75 in this example, and why "Tap" would only register after the button is released and such.
This one thing has forever confused me. And it usually is responsible for stuff not working.
no code examples, what a shame
I briefly showed a small code sample at the beginning, but I'll keep that more in mind for future informational videos, thanks.
Background music really makes it difficult to focus on what is being spoken in the video and it's content. Too bad because it could have been a very useful video.
Sorry about that! I haven't added music to any of my other videos and will continue not to unless it is a devlog or fun video :)
Budden
buddin
Are you Indian
Nope!
Thanks!