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
  • Навчання та стиль

КОМЕНТАРІ • 131

  • @WoahGuyy
    @WoahGuyy 3 роки тому +46

    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.

    • @samyam
      @samyam  3 роки тому +5

      Thank you so much :)

  • @Aedeus
    @Aedeus 3 роки тому +12

    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.

    • @samyam
      @samyam  3 роки тому

      Thanks! 🙂

  • @reneemei9840
    @reneemei9840 2 роки тому

    Thank you! Cleared all my confusion in 10min. Simply amazing

  • @qqq9542
    @qqq9542 3 роки тому

    Duude this video was so well made and edited, from the pleasing visuals to the BG music adjusted at the right volume. So underrated!!! :)

    • @samyam
      @samyam  3 роки тому +1

      Glad you enjoyed it!! Thank you 😄
      It was partly made in Canva and put together in the editing program :)

  • @ArkahnX
    @ArkahnX 2 роки тому +1

    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

  • @vishalgupta5288
    @vishalgupta5288 3 роки тому

    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... :)

    • @samyam
      @samyam  3 роки тому

      Thank you :)

  • @erickalfaro8389
    @erickalfaro8389 2 роки тому

    Honestly, I'm blown away. This tutorial is amazing.

    • @samyam
      @samyam  2 роки тому

      Thank you so much! :)

  • @AM-dj4vp
    @AM-dj4vp 3 роки тому

    so many hours of googling and im happy this is where i ended up. Thanks!!

  • @KarasawaL30
    @KarasawaL30 2 роки тому

    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™

    • @samyam
      @samyam  2 роки тому

      Glad I could help 😅😂

  • @MrJuancho2706
    @MrJuancho2706 3 роки тому +1

    This is the kind of video i told you about! you are a beast! :D

  • @CoderDev6545
    @CoderDev6545 Рік тому

    simple, yet informative!

  • @SarithNugawila
    @SarithNugawila Рік тому

    Awesome video series, saved me lots of time, thank you! 👏❤

  • @MetalStormGames
    @MetalStormGames 2 роки тому

    Best series for new input system I have found, keep them coming

    • @samyam
      @samyam  2 роки тому

      Thanks so much :) More videos on my channel!

  • @aesthezel
    @aesthezel 3 роки тому

    You're a pure energy on UA-cam and Gamedev, thanks for upload videos

    • @samyam
      @samyam  3 роки тому

      Thanks for watching 🙂

  • @tanmaysalaskar
    @tanmaysalaskar 3 роки тому +5

    Why this channel is so underrated?

    • @samyam
      @samyam  3 роки тому +3

      It’s growing pretty well! And thanks 🙂

  • @lpeabody
    @lpeabody 2 роки тому

    This channel is fire. Thank you very much for helping us out!

    • @samyam
      @samyam  2 роки тому +1

      🔥😂 Thank you!!

  • @Mr.Epsilion
    @Mr.Epsilion 3 роки тому +3

    Best explanation, thanks so much :P

  • @virtualmaestro6893
    @virtualmaestro6893 3 роки тому +8

    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).

    • @samyam
      @samyam  3 роки тому +2

      Yes that’s my plan! But first I have to do the patron video :)

  • @dima5467
    @dima5467 3 роки тому +1

    Very clear and concise information presented with nice visuals, thanks. This channel will explode soon.

    • @samyam
      @samyam  3 роки тому +1

      Thanks so much! :)

  • @bigjohninyourwalls
    @bigjohninyourwalls Рік тому

    Here from reddit, you're awesome!

  • @pagoda_dimensionale9761
    @pagoda_dimensionale9761 3 роки тому

    Amazing video and amazing professionality.

    • @samyam
      @samyam  3 роки тому

      Thank you!

  • @__dane__
    @__dane__ 3 роки тому +3

    Samyam and IHeartGameDev are easily my favorite new unity channels

    • @samyam
      @samyam  3 роки тому +2

      🎉 awesome!

  • @while.coyote
    @while.coyote 10 місяців тому

    Thank you! My buddens are working now!

  • @tanujcherian3911
    @tanujcherian3911 2 роки тому

    Hey, Thank you for the explanation, you did a fine job, Cheers!

  • @kohaaa
    @kohaaa 6 місяців тому

    Thank you so much, you saved my day :)

  • @cgmaxman
    @cgmaxman 3 роки тому +1

    Hey thanks, was really informative video : )

  • @BrianLindahl
    @BrianLindahl 2 роки тому

    brillant video!

    • @samyam
      @samyam  2 роки тому

      Thank you!!

  • @NathanRohner
    @NathanRohner 3 роки тому +1

    Great video!

  • @d5k4capy62
    @d5k4capy62 2 роки тому

    ty very much ,so it was before my eyes......

  • @Adhyaatma
    @Adhyaatma Рік тому

    Thank You.

  • @matheusreidopedaco
    @matheusreidopedaco 2 роки тому

    great video!

    • @samyam
      @samyam  2 роки тому +1

      Thanks!!

  • @christo-j5507
    @christo-j5507 3 місяці тому

    Love your tutorial and your voice is so sweet!!!!!

  • @DavidZobristGames
    @DavidZobristGames 2 роки тому

    Thanks!

  • @dushes_botalov
    @dushes_botalov 3 роки тому

    Thank u ☺️

  • @maxfun6797
    @maxfun6797 2 роки тому

    thank you

  • @todthesushimonster1256
    @todthesushimonster1256 2 роки тому

    Wow it's the first actually helpful tutorial on the new input system. Thank you!
    Edit: Oh you're not active anymore :( sadness

    • @samyam
      @samyam  Рік тому

      What do you mean not active? I post regularly 😄

    • @todthesushimonster1256
      @todthesushimonster1256 Рік тому

      @@samyam Oh I didn't realize! I was just looking at your home page and most of it is from like a year ago

  • @pietro0games
    @pietro0games 3 роки тому +2

    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

  • @Rioni
    @Rioni 15 днів тому

    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

  • @MagnifiqueRarity
    @MagnifiqueRarity 3 роки тому +1

    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?

    • @samyam
      @samyam  3 роки тому +1

      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_

  • @DanPos
    @DanPos 3 роки тому

    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!

    • @samyam
      @samyam  3 роки тому

      Thanks! Yeah, hopefully it’ll be revamped in the future

  • @cinnamonrollstudios3228
    @cinnamonrollstudios3228 3 роки тому +1

    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

    • @samyam
      @samyam  3 роки тому +2

      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

  • @LukeHwarang
    @LukeHwarang 2 роки тому +1

    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? ༼ つ ◕_◕ ༽つ

    • @samyam
      @samyam  2 роки тому +2

      They do but it’s pretty hidden 😂 Had to search through the Github repo for a lot of this information

  • @gfujigo
    @gfujigo 5 місяців тому

    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

  • @sohjingkaisean3934
    @sohjingkaisean3934 2 місяці тому

    Man i need help with unity new input system. I have no idea how to detect on screen button pressed

  • @DerperDoing
    @DerperDoing 3 роки тому +3

    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?

    • @samyam
      @samyam  3 роки тому +1

      Who knows maybe one day! 😂

    • @DerperDoing
      @DerperDoing 3 роки тому

      @@samyam Let's just hope, that day is soon enough XD

  • @princetbug
    @princetbug 2 роки тому

    so how do you get values from the inputs-- on the script side?

    • @princetbug
      @princetbug 2 роки тому

      nevermind, I found it. was missing the type definition in ReadValue

  • @DavidBoura
    @DavidBoura 3 роки тому +1

    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... ; )

    • @samyam
      @samyam  3 роки тому +1

      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

    • @DavidBoura
      @DavidBoura 3 роки тому

      @@samyam I wasn't considering the cinemachine tuto, but now I think it will make the two others more understandable. Thank you Samyam 👍

  • @Vaasu97
    @Vaasu97 Рік тому

    Can you define what the stuff means on the left most column in the graph at 3:11

  • @TheKr0ckeR
    @TheKr0ckeR 2 роки тому

    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.

    • @samyam
      @samyam  2 роки тому

      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

    • @TheKr0ckeR
      @TheKr0ckeR 2 роки тому

      @@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".

  • @dj51401
    @dj51401 3 роки тому

    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"

    • @samyam
      @samyam  3 роки тому

      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.

    • @dj51401
      @dj51401 3 роки тому

      @@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.

    • @dj51401
      @dj51401 3 роки тому

      @@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.

  • @goesupsoft
    @goesupsoft 3 роки тому +1

    Hey , can you tell me why player stuck in tile while jumping at edge in 2d platform game .
    Please Reply, how to solve it?

    • @samyam
      @samyam  3 роки тому

      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

    • @goesupsoft
      @goesupsoft 3 роки тому +1

      @@samyam hey samyan I already tried 😢 but nothing happen , please help me , I build my game using bayat platform assets for playstore .please

    • @samyam
      @samyam  3 роки тому +1

      Check how big your colliders are, you might be overlapping the friction one with the non friction one.

  • @n8dev
    @n8dev 3 роки тому

    yessssssssssssssss

  • @libberator5891
    @libberator5891 3 роки тому

    I don't press like on any video, but here's a comment to help with the ~~algorithm~~. Keep it up Sam! :)

    • @samyam
      @samyam  3 роки тому +1

      Thank you!!

  • @geroy8119
    @geroy8119 3 роки тому

    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. :(

    • @samyam
      @samyam  3 роки тому

      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?

    • @geroy8119
      @geroy8119 3 роки тому

      @@samyam I just got Unity and I'm using 2020.3 12

    • @geroy8119
      @geroy8119 3 роки тому

      @@samyam I probably didn't install the input system

    • @geroy8119
      @geroy8119 3 роки тому

      @@samyam I don't really know how to do anything sadly

    • @samyam
      @samyam  3 роки тому

      I have a mini series for Unity beginners if you’re interested
      ua-cam.com/play/PLKUARkaoYQT178f_Y3wcSIFiViW8vixL4.html

  • @nahuelpaillapi
    @nahuelpaillapi 2 роки тому

    Wow

  • @iR3dy
    @iR3dy 3 роки тому

    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 🤔 🧐👀👀

  • @Downfooyohomie
    @Downfooyohomie 3 роки тому

    can you doa vide where a joystick dose anaimation

    • @samyam
      @samyam  3 роки тому

      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.

  • @goesupsoft
    @goesupsoft 3 роки тому +1

    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.

    • @samyam
      @samyam  3 роки тому +1

      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.

    • @goesupsoft
      @goesupsoft 3 роки тому +1

      @@samyam can you provide me link of some examples of code .

    • @samyam
      @samyam  3 роки тому +1

      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.

    • @goesupsoft
      @goesupsoft 3 роки тому +1

      @@samyam Thank You😊🇮🇳

  • @Vastlee
    @Vastlee 3 роки тому +2

    You spelled Buddon wrong in the title. Good video!

  • @peacesafe3087
    @peacesafe3087 3 роки тому

    Hi. Can u make drag and shoot system like soccer stars game. Plz

    • @samyam
      @samyam  3 роки тому

      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

  • @watercat1248
    @watercat1248 2 роки тому

    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

    • @samyam
      @samyam  2 роки тому

      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

    • @watercat1248
      @watercat1248 2 роки тому

      ​@@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

  • @Ezio727
    @Ezio727 3 роки тому

    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

    • @samyam
      @samyam  3 роки тому +1

      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

    • @Ezio727
      @Ezio727 3 роки тому

      @@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.

    • @samyam
      @samyam  3 роки тому

      If you read the value directly from the action you’ll know if it’s pressed
      action.ReadValue()

    • @Ezio727
      @Ezio727 3 роки тому

      @@samyam i see 😊

  • @nanyubusnis9397
    @nanyubusnis9397 9 місяців тому

    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.

  • @neenaw
    @neenaw 3 роки тому

    This one thing has forever confused me. And it usually is responsible for stuff not working.

  • @premonsa
    @premonsa 3 роки тому

    no code examples, what a shame

    • @samyam
      @samyam  3 роки тому

      I briefly showed a small code sample at the beginning, but I'll keep that more in mind for future informational videos, thanks.

  • @zivv1147
    @zivv1147 2 роки тому

    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.

    • @samyam
      @samyam  2 роки тому

      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 :)

  • @Joooooooooooosh
    @Joooooooooooosh 2 роки тому

    Budden

  • @ApexArtistX
    @ApexArtistX 3 роки тому

    Are you Indian

  • @TheAwesomeShaz
    @TheAwesomeShaz 2 роки тому

    Thanks!