Input System Interactions Explained | Press, Hold, Tap, SlowTap, MultiTap - Unity

  Рет қаралды 66,867

samyam

samyam

Күн бұрын

Пікірлер: 130
@beanarine
@beanarine 10 ай бұрын
This actually helped me understand what was wrong with my mouse interactions, as opposed to the dozens of articles and videos that just tell me "it's so simple! Here's a snippet of isolated code and 5 seconds explaining half of what's happening"
@AetherXIV
@AetherXIV 3 жыл бұрын
new input system tuts are so rare. thank you for going deep on this for us
@8bbp
@8bbp 2 жыл бұрын
Your video literally saved me hours of painful trial & error tests. Thank you very much!
@xanarihstudios2997
@xanarihstudios2997 3 жыл бұрын
Your the only person consistently putting out new input tutorials so thank you so much! Do you think by any chance we will get a collision tutorial using the new 3rd person starter asset? Like damage detection or prompt player when they can perform certain actions by standing close enough to the target object.
@samyam
@samyam 3 жыл бұрын
Thanks! I hadn’t planned it but it’s a good idea. Maybe in the future! But for the latter you can use a collider with IsTrigger checked and implement the OnTriggerEnter function docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html
@schmuck924
@schmuck924 2 жыл бұрын
Simple. Clear. Pertinent. Best in class, Samyam. Thank you so much for these!
@samyam
@samyam 2 жыл бұрын
Thank you! 😄
@krissloo143
@krissloo143 3 жыл бұрын
Another great video Thank you documenting the new input system better than Unity itself did
@samyam
@samyam 3 жыл бұрын
Thank you :)!
@JakubMachowski
@JakubMachowski 2 жыл бұрын
Thanks for that. You did what unity should do with their manual. Thanks a lot for that especially things since 6:30 :)
@Dailyfiver
@Dailyfiver 3 жыл бұрын
Thanks!
@Dailyfiver
@Dailyfiver 3 жыл бұрын
This Video seriously saved my bacon. I have been struggling with understanding this for almost a month! I appreciate you being so thorough. Just subscribed, keep up the great work!
@samyam
@samyam 3 жыл бұрын
Glad it helped!!
@Shotgunfoot
@Shotgunfoot 2 жыл бұрын
Cannot express my gratitude enough in helping me understand how to handle multiple interactions on a button. If I could like twice.
@samyam
@samyam 2 жыл бұрын
Your comment is very much appreciated! :)
@vishalgupta5288
@vishalgupta5288 3 жыл бұрын
As always... you literally are the best and go-to for the new Input System modules... Thanks for making it so clear... :) Keep it up...
@samyam
@samyam 3 жыл бұрын
Thank you :)!
@Tarodev
@Tarodev 2 жыл бұрын
Super thorough, thank you!
@radinapetrova8307
@radinapetrova8307 3 жыл бұрын
You are amazing ! I kind of never have seen videos which explain things in details , as you do ! If there was a scoring system in KZbin , your score would be 20 ot of 10 :) .
@samyam
@samyam 3 жыл бұрын
That's so nice!! Thank you so much :)
@TechHamlin
@TechHamlin 10 ай бұрын
This is so good content. Thanks for the great work! Helping me out a lot in my project! :-)
@AstralNostalgia
@AstralNostalgia 2 жыл бұрын
hey there I need to create a "hold" button... I think it works in some manner, but how can I check the stats of time of how long I am pressing the holded button? for example I need to hold a button for hide my characters in the shadow... when I releaste the button I need to procedd to use other animations such as the idle state... but when I hit "w" in my keyboard I need to Hold amount of time the "w" key to switch from Idle or walking to the "hided" state... thx.
@SquidKid09
@SquidKid09 Жыл бұрын
I am having the same problem
@AlarmedPizza
@AlarmedPizza 3 жыл бұрын
Thank you for the concise instructional video! Probably saved hours in implementing input controllers after learning this.
@samyam
@samyam 3 жыл бұрын
Awesome! Thanks :)
@abdulkadirdursn
@abdulkadirdursn 3 жыл бұрын
Thanks a lot for this video. I look at the documentation but there are still too many thing i dont understand. This video helped me understand some of them clearly.
@samyam
@samyam 3 жыл бұрын
Awesome!
@snek5385
@snek5385 2 жыл бұрын
Thanks for sharing! Now I will definitely try to apply input interactions in my current project.
@SquidKid09
@SquidKid09 Жыл бұрын
Amazing tutorial! I was just wondering why I keep getting errors like "The type or namespace name 'HoldInteraction' could not be found" Is it some sort of call at the beginning of the script? I'm probably just missing something really stupid though... lol
@ayzermiomuniverse8729
@ayzermiomuniverse8729 Жыл бұрын
Thank you for this video, great explanation, saved me a lot of time
@TwinGhosts
@TwinGhosts 3 жыл бұрын
Very nice video, thank you! Great voice for a tutorial, and I loved the editing too.
@samyam
@samyam 3 жыл бұрын
Thank you!!
@usercontent2112
@usercontent2112 Ай бұрын
Excellent video!
@samyam
@samyam Ай бұрын
Thank you!
@castlecodersltd
@castlecodersltd 2 жыл бұрын
This was brilliant, thank you for sharing
@celloj3703
@celloj3703 Жыл бұрын
This is exactly what I need! Thank you!
@Chris-yq1fw
@Chris-yq1fw Жыл бұрын
Hi, at 6:41, Why the "Press" is not performed ? As "Press" is not affected by the time but rather by Press point, in this case, you use keyboard then shouldn't it be triggered also ?
@user-em9su3dd9y
@user-em9su3dd9y 3 жыл бұрын
Really well presented thanks!
@MikeKing710
@MikeKing710 Жыл бұрын
How can I make this input interact like I press the button once, not holding and the gameobject continues move forward?
@HugoCortell
@HugoCortell 2 жыл бұрын
Is it possible to use modifiers to disable/enable joystick 2D vectors? It seems like it only works for individual bindings rather than entire groups.
2 жыл бұрын
How can i jump in the next intercation? Example: I have interaction hold and tap on mouse press button, if i dont have the mouse on a gameobject in the game i instantly want to skip the hold interaction and check if taped. So i want to cancel the hold interaction. How can i do that? Sry for bad english
@kilosayaw
@kilosayaw Жыл бұрын
This was very clear to follow thank you! Do you know if the unity input system allows for action maps with simultaneous actions? Like 3 fingers tapping at the same time to perform a certain action? If so is that covered anywhere? Thanks!
@willlacey7621
@willlacey7621 Жыл бұрын
Great video! Thanks!
@QHuy11
@QHuy11 3 жыл бұрын
Thanks, this is exactly what I was looking for
@amirmehmood2878
@amirmehmood2878 2 жыл бұрын
Samyam great tutorial thanks alot. again great job.
@samyam
@samyam 2 жыл бұрын
Thank you!!
@stefanovecchio6134
@stefanovecchio6134 3 жыл бұрын
Great video, it's exactly what I needed! :D
@samyam
@samyam 3 жыл бұрын
Thanks!
@whiskers1560
@whiskers1560 3 жыл бұрын
Thank you so goddamn much. I hope you keep this up.
@wastelandsteampunk3391
@wastelandsteampunk3391 2 жыл бұрын
what if I'm using First Person with camera follows, does the camera needs raycast ?
@clavesi
@clavesi 3 жыл бұрын
Just what I was needing!
@lakminiliyanage6273
@lakminiliyanage6273 3 жыл бұрын
So I'm watching now this was premier in night
@davidbarnaba7229
@davidbarnaba7229 2 жыл бұрын
I've got a question. I encountered an issue with this new system. Basically I want a bool to become true the moment you press the button, then change to false after, let's say, 0.5 sec, even if you hold down the button. Tried different combinations of interactions (press, tap, etc) and callback (started, performed, canceled) but nothing seems to work. If I hold down the button the bool remains true. Any suggestion? Thank you very much
@samyam
@samyam 2 жыл бұрын
How are you setting this boolean? Maybe you are setting it once it is true, but not setting it to false in the canceled callback. I believe tap would be the best interaction for this
@battlelab5523
@battlelab5523 3 жыл бұрын
Is it possible to change / override the interaction of actions at runtime? I need to add or remove interaction at runtime, I also hope it is possible to store the overridden interaction in json so that it can be loaded the next time the game is started. Is there a way to do this? I could not find any information about this Im using generated C# class
@unityshorts5543
@unityshorts5543 3 жыл бұрын
at 7:25 while doing multi tap the code is also registering single tap event how to avoid that i want a function to run on single tap and a different function to run on multi tap and when multi tap function is executed single tap function should not run
@samyam
@samyam 3 жыл бұрын
Hm you can try adding both a multi tap and tap event to the same action or binding, but have the multi tap at the top of the list, so that if that event is canceled for some reason (aka, the user doesn’t do the multi tap) then it transfers over to the tap processor and executes it forum.unity.com/threads/having-multitap-interaction-issues.859300/
@unityshorts5543
@unityshorts5543 3 жыл бұрын
@@samyam thanks a lot :)
@unityshorts5543
@unityshorts5543 3 жыл бұрын
@@samyam i felt like it worked initially but i noticed that the response is a little slow like when it registers the cancelled event for multi click after that the function for click is executed this behavior does not work for my case i need the reaction to be immediate Current code :- private void Awake() { mainCamera = Camera.main; input = new InputMaster(); input.Actions.Click.canceled += ctx => shoot(); input.Actions.Click.performed += ctx1 => rotate(); } void shoot() { DetectObject(); Debug.Log("started"); } void rotate() { RotateObjects(); Debug.Log("performed"); }
@samyam
@samyam 3 жыл бұрын
There’s no way for the tap not to be performed once the multi tap starts since you are tapping, so you’d need to check manually depending on what you are tapping on I have a video here if you want to get the object under the mouse click (or finger touch in this case) kzbin.info/www/bejne/gHqnaIyXfaangaM
@LexGear
@LexGear 2 жыл бұрын
Bravo. Good video.
@samyam
@samyam 2 жыл бұрын
Thank you!
@TheRealMarj
@TheRealMarj 2 жыл бұрын
Hope you can help me, but how can I make so when two buttons are pressed it will execute a new action instead of the ones those buttons are “binded” to? Thanks for the tutorial btw
@samyam
@samyam 2 жыл бұрын
You can create a new modifier action with those two buttons, but if you use those same bindings set for a different action it will still execute, which is a unfortunate you’ll need to manually check in your code that your not executing the code for the individual buttons if both are pressed.
@TheRealMarj
@TheRealMarj 2 жыл бұрын
@@samyam manage to figure it out. Thank you so much anyways. Love your videos. They have helped me a lot.
@samyam
@samyam 2 жыл бұрын
Glad to help!
@iR3dy
@iR3dy 3 жыл бұрын
What would be the best input action and interaction to use for say, if you grab something you have through it? Would I set up 2 different inputs for this so say I press E to interact which will pick up the grab the box and I have to hold shift to aim and press E to throw again? Or maybe Just press E again to drop the item. Would a custom one be the best option?
@samyam
@samyam 3 жыл бұрын
A custom one would be useful if these actions had to be performed in a certain way or pattern, however if the player is just picking it up and can throw it whenever they'd like, I'd make it two different events or actions, depending on the behaviour you want. If you'd like it to be the same button you can differentiate in the callback if (context is SlowTap) This will be performed once the use has held it and let go, then you can throw it. Hope that helps!
@gonchi2610
@gonchi2610 Жыл бұрын
great video!! any ideas on how could I use this for a double W running system like in most fps games?
@quentinhonore3839
@quentinhonore3839 2 жыл бұрын
Do you know how I can change the "HoldTime" of the hold interaction at runtime? It's because i created a "Hold spacebar to jump higher" mechanic in my game with the help of hold interaction. I want to modify the HoldTime in-game when I get a bonus but the interactions are read-only when I look at it in my code. I tried to create a custom interaction with a function to set the duration value but failed...
@joshuabidwell2614
@joshuabidwell2614 2 жыл бұрын
If you want to do a Mario jump, do your normal velocity change/force application on button action start/performed whatever but then check if it's held each update with another bool like jumpHeld = jumpAction.IsPressed();
@vick3554
@vick3554 3 жыл бұрын
Hii.. Please how can I increase the perform phase for a 3rd person shooter I made. I want to click, then watch the player shoot animation play and then back to idle state.
@samyam
@samyam 3 жыл бұрын
You can’t increase the perform phase, it’ll be called once an action is performed or not. You’ll have to manage that through your code directly. For example in your function that is called when .perform is executed, you can play the shooting animation, and in the animation graph set the transition from shooting to idle, and check Exit Time checkbox, so that the idle will automatically start playing when the firing animation finishes.
@vick3554
@vick3554 3 жыл бұрын
@@samyam so I make a parameter between them in the animator... But honestly the input system is too hard
@vick3554
@vick3554 3 жыл бұрын
@@samyam ..Ok.. so I use parameters in the animator and then untick exit time and loop time...
@samyam
@samyam 3 жыл бұрын
It has a learning curve but once you learn it it makes life simpler! :)
@vick3554
@vick3554 3 жыл бұрын
@@samyam But how long has it taken you
@inksword6029
@inksword6029 8 ай бұрын
how can i make multi tap and hold?
@YeahThatGuy7
@YeahThatGuy7 3 жыл бұрын
Hey, I was hoping you could clear something up for me. How should I make it so a button needs to be NOT pressed for an action to work. Example: Jump is A on a controller but not when RT is being pressed/held (the reason for this is I want RT+A to be a different action).
@samyam
@samyam 3 жыл бұрын
You can either do a manual check in your code jump.performed => { if pressing RT, don't jump } Or you can possibly make a custom modifier which I explain here, where you can take in the jump and RT, and only perform the Jump when the RT isn't pressed. kzbin.info/www/bejne/gYmpZIKIbJ2cjLs
@YeahThatGuy7
@YeahThatGuy7 3 жыл бұрын
@@samyam Earlier I followed one of your other videos and made a processor that makes 0 into 1 and 1 into 0 (in order to detect if RT wasn't being pressed). That didn't seem to work, am I misunderstanding processors? I basically need the modifiers to fire when they are NOT pressed. So A is the button and RT is the modifier and as long as RT is not being pressed it listens for A
@samyam
@samyam 3 жыл бұрын
@@YeahThatGuy7 Processors are executed at the end, they change the output once it's been processed, so the modifier won't know about the processor's changes. You need to do that check in your modifier instead.
@rdothl5
@rdothl5 Жыл бұрын
Isnt the whole point of new input system not to set explicitly strings in code for actions but to catch events using predefined callbacks?
@-_IT_-
@-_IT_- 3 жыл бұрын
You explain very well and you touch on things I have not yet heard from other videos on unity. I first heard about the new input system from you. Now I have to learn about that, so I will be sticking around, so thank you!
@samyam
@samyam 3 жыл бұрын
Thank you 😄
@JackyTran
@JackyTran 3 жыл бұрын
Once agin, great tutorial
@samyam
@samyam 3 жыл бұрын
Thank you!
@AlexJrDev
@AlexJrDev 3 жыл бұрын
Would this input system still be useful in late 2021 / 2022? Since I Believe unity made some updates to their input system so just wondering.
@samyam
@samyam 3 жыл бұрын
Yes!
@nanyubusnis9397
@nanyubusnis9397 Жыл бұрын
6:23 "Because you don't want the time between each of the taps to be too long because then it won't really register as a multi-tap." This is incorrect. What she meant to say was either: "You don't want the time to be too long, or it *will* register as a multi-tap." Like when you accidently press the button again within that time." Or "You don't want it too *short* or else people might not be fast enough because it *won't* register as a multi-tap." (Or she wanted to make an opinion and meant to say: "You don't want it to be too long, or it's not really a multi-tap." Like we all understand 'double-click' means you have to press the mouse button twice rapidly, or else you're just selecting the same thing twice. Which in turn, things like windows might interpret to mean you want to change the name, rather than merely select, or open a certain document. But I mean this is just opinion. A multi-tap is a multi-tap as long as the second tap falls within an arbitrarily defined time.)
@luciorojas4278
@luciorojas4278 3 жыл бұрын
I love the way it is explained and how detailed this is but I have a genuine question to all amateur users like me or unity users in general. isn't this new input system way more tedious or complex to use to achieve basic actions than the previous input system?
@samyam
@samyam 3 жыл бұрын
It does require more upfront management and complexity, but the nature of it is to simplify cross platform input so in the long run it simplifies your life a lot rather than using the old one. I also really like using events for input. There is a learning curve but at least I think it’s worth it :) Thanks!
@luciorojas4278
@luciorojas4278 3 жыл бұрын
@@samyam thank you for taking the time to reply and for your amazing tutorials!, I'll follow your advice and keep learning it until I figure it out :D
@Foxtrop13
@Foxtrop13 3 жыл бұрын
so, it is a nightmare, long live the old input system, good work on the tutorial anyways
@samyam
@samyam 3 жыл бұрын
It is quite confusing at times not going to lie. Once you get used to it it gets better
@LukeHwarang
@LukeHwarang 3 жыл бұрын
Thank you! =)
@munchymcmouthington298
@munchymcmouthington298 3 жыл бұрын
Thank you for your tutorials, they're very clear. I understand what the new system is trying to solve but I'm absolutely mystified as to why they made it so opaque and complex in the process. I'm in industry (albeit, different toolchains day to day) and have coded for over 10 years in multiple frameworks/languages/etc. Heck, I've written in assembly... So If I'm struggling with it, what chance do newbies have?!
@samyam
@samyam 3 жыл бұрын
I agree it is pretty complicated to start, and the documentation doesn’t really help matters. I think they should spend more time on the docs at least, or perhaps make it less verbose.
@munchymcmouthington298
@munchymcmouthington298 3 жыл бұрын
It kind of takes me back to old DotNet documentation quite honestly; I've reported several pages because examples are either limited (for example, missing imports or context or missing demonstrations of where you might actually embed a specific stub) or altogether absent. I think they assume too liberally that their audience will have a good grasp of how to do things like find and import the correct dependencies for a specific class (e.g. the Interactions package)... Stuff like that can easily confuse/overwhelm novices. Oh well :/ hopefully this will all get smoothed out over time...
@alfredoeleazarorozcoquesad2988
@alfredoeleazarorozcoquesad2988 2 жыл бұрын
You da best!!!!
@ElNerdgasmo
@ElNerdgasmo 3 жыл бұрын
Thanks
@pixelman457
@pixelman457 3 жыл бұрын
hi i’m having issues joining your discord server . it keeps saying server requirements have changed
@samyam
@samyam 3 жыл бұрын
Hm try this link, and make sure your email is verified with Discord discord.gg/mj3dSnmaZc
@pixelman457
@pixelman457 3 жыл бұрын
@@samyam same issue. and my email is verified
@samyam
@samyam 3 жыл бұрын
Seems people online say to either update the app, or try it on web
@pixelman457
@pixelman457 3 жыл бұрын
@@samyam oh thanks it works now
@User33423
@User33423 3 жыл бұрын
coud you make a tutorial on how to make a mobile swipe fps cam in new input system, like in most mobile fps shooters i am realy lost and have no clues what to do, google didnt help either.
@samyam
@samyam 3 жыл бұрын
I have a first person video here kzbin.info/www/bejne/a5_CmaCnfcmcoK8 And then a video on third person joystick to look around kzbin.info/www/bejne/j4eYfIKQfdh8sJY So instead of using the third person camera, you can use the first person camera, and the rest is almost the same. In the joystick video I use a “hack” to move the screen by placing an invisible joystick in the camera area to move the camera (on screen joystick) however I have a video on swiping if you don’t want to use that hack kzbin.info/www/bejne/jobbkISif9WXZq8
@User33423
@User33423 3 жыл бұрын
@@samyam tnx i did it using touchscreen delta
@mademade5939
@mademade5939 3 жыл бұрын
Oh no, i dont know you live...love your video...anyway have you create a tutorial new input system for crosplatform pc and mobile?
@samyam
@samyam 3 жыл бұрын
I've done several tutorials on Touch controls, and most actions you can test on the computer (actions that require one finger) kzbin.info/www/bejne/e4Okf2iBd95lfdU You can add several bindings under an action, one for mobile and pc. However it might be tricky for emulating pinch where you need 2 fingers, you should differentiate what platform you are on and adjust it accordingly. Or you can possibly make a custom binding and interaction to support seamlessly switching between them!
@CoreGames2000
@CoreGames2000 2 жыл бұрын
but release trigger is not working correctly : (
@Betruet
@Betruet 2 жыл бұрын
I'm just finding this out and its killing me :/
@melihcanozdemir7309
@melihcanozdemir7309 3 жыл бұрын
Can you do a dialogue system in 2D and 3D
@samyam
@samyam 3 жыл бұрын
So like Mass Effect where you can choose different options, or just simple npc dialogue?
@melihcanozdemir7309
@melihcanozdemir7309 3 жыл бұрын
@@samyam Yes, like Mass Effect. Also you are so concerned with your subs. Thanks for everything
@samyam
@samyam 3 жыл бұрын
Something like that is on my list, got a lot of stuff I want to cover though, let’s see! And thank you :)
@erosjagatpulagana6403
@erosjagatpulagana6403 3 жыл бұрын
Am I too soon? I'M TOO SOON
@samyam
@samyam 3 жыл бұрын
Only ~30 minutes left!
@KillerGameDev
@KillerGameDev 3 жыл бұрын
Id LOOOOOVE to see this with something like photon or mirror involved(anything networked). Ive seen a few confusing things where controls for one computer are affecting a computer over the network making things like player movement impossible.
@samyam
@samyam 3 жыл бұрын
Maybe one day! 🙂
@tmate88-j8y
@tmate88-j8y Жыл бұрын
The cube visual was super helpful! Thank you so much for this video. Unity docs are awful.
@nguyenvankhanhduy3958
@nguyenvankhanhduy3958 2 ай бұрын
Wow!!!!
@greenTech88
@greenTech88 3 жыл бұрын
Android button customise tutorial call of duty mobile
@samyam
@samyam 3 жыл бұрын
Not currently in my near planned videos sorry!
@ShatabdaRoy115
@ShatabdaRoy115 3 жыл бұрын
Android?
@samyam
@samyam 3 жыл бұрын
Interactions should also work on Android, that's what is great about the input system!
@VolkGam
@VolkGam 2 жыл бұрын
Hello! Multi Tap does not work. Works only .started, .canceled. This does not work: _controlls.Enter.MultiTouch.performed += _ => Peformed(); I'm doing everything right. I need a double click on the screen. On a tablet, double-click works in other applications. Why do you think I can't get the performed event when I double-click with my finger on the screen? It just doesn't work. I tried changing the Button to Pass Through + Button, Touch, Double - the same thing... There is a discussion of this problem on the Unity Forum - MultiTap not working with Keyboard/Mouse + Gamepad active simultaneously. Help people if you know how to solve this problem. Thanks!
The Power of Scriptable Objects as Middle-Men
17:41
samyam
Рет қаралды 131 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
How to use Unity's Input System
31:47
samyam
Рет қаралды 152 М.
Unity's "NEW" Input System with C# Events
16:46
One Wheel Studio
Рет қаралды 92 М.
Unity's New Input System:  The Definitive Guide
32:07
DmanGames
Рет қаралды 34 М.
How to use TOUCH with the NEW Input System in Unity
24:11
samyam
Рет қаралды 75 М.
How to use Unity's New INPUT System EASILY
9:32
BMo
Рет қаралды 244 М.
the comments on my indie game were interesting...
9:00
samyam
Рет қаралды 22 М.
How to make AWESOME Scene Transitions in Unity!
19:45
Brackeys
Рет қаралды 967 М.
every step to actually make your dream game (then sell it)
24:27
little girl and homeless man😱❤️👻 #shorts
0:55
Positive Energy-Funny family
Рет қаралды 16 МЛН
Одноклассники съели мои чипсы 😂 #shorts
0:41
Вика Андриенко
Рет қаралды 1,9 МЛН
Ciccio impazzito 🤣
0:16
Ciccio e Maria
Рет қаралды 28 МЛН
Проверил, как вам?
0:59
Коннор
Рет қаралды 4,1 МЛН