Unity new Input System - The SIMPLEST way

  Рет қаралды 42,409

RumpledCode

RumpledCode

Күн бұрын

Пікірлер: 120
@maxgames.5690
@maxgames.5690 4 жыл бұрын
finally a video about the new input system that goes straight to the point and isn't long, ty very much
@Enginering
@Enginering 4 жыл бұрын
lol 😂 i was trying to comment same thing
@Jicefrost
@Jicefrost 4 жыл бұрын
same comment)
@lepe
@lepe 4 жыл бұрын
I couldn't stop staring at that "OnDisalbe" lol
@goldkat99
@goldkat99 3 жыл бұрын
Absolutely brilliant, I had given up on my game back in march because I tried to refactor it to the new input system and I could not figure it out. All of the documentation and videos at the time were incredibly confusing but your video was comprehensive and straight to the point.
@johneyre9493
@johneyre9493 3 жыл бұрын
This was by far the best tutorial I've seen on the new Input system.
@kitchenspider1539
@kitchenspider1539 4 жыл бұрын
A much needed tutorial, thank you! For a long time I was confused by the input action controller component and linking it to events. Now that I see how this is implemented purely in code, it is a lot clearer (and cleaner imo).
@wadeeliason969
@wadeeliason969 4 жыл бұрын
I agree. I had created a character and code from various tutorials using the old input system. But was a little confused on how to migrate to the new system. My other thought is implementing it into the UI controlling.
@kitchenspider1539
@kitchenspider1539 4 жыл бұрын
@@wadeeliason969 I think the biggest source of confusion for me was the PlayerInput component, which is imo virtually worthless and I've heard there is a consensus on that. I kept thinking the Input control asset, the PlayerInput component and the code were all supposed to work together as one system when in actuality you're better off using the asset w/code, or doing it all with code in simpler cases like the video here. Infallible Code has an excellent video on using the asset without the confusion of having the PlayerInput component here: kzbin.info/www/bejne/o6fYiYKvgN9qoZY Thats if you need a bit more complexity to the assignment of your controls without having to hard code each callback. He uses an interface from the auto-generated class to automagically generate all the events and their callbacks for you... so you basically reference ONE thing (the interface) and you can do your OnMove(), OnJump(), or whatever actions you have set up in the asset without having to do all the other crap, like the lambda callback ctx statements for every action. I didn't know these callbacks were already coded in the auto-generated class as an interface until I watched this video, and this has simplified the input system tremendously for me.
@kodaxmax
@kodaxmax 4 жыл бұрын
@@kitchenspider1539 yeh im not sure how they ever thought the added convolutedness of needing a controller and such was easier than typing Input.getAxis("buttonName");
@visclo4782
@visclo4782 4 жыл бұрын
ah it's so sad I can't kiss you because of the pandemic, thank you sooo much dude! 9 min video and you managed to learn me something I couldn't figure out for a whole day
@polarcat0156
@polarcat0156 4 жыл бұрын
that's sus
@RumpledCode
@RumpledCode 4 жыл бұрын
00:21 - Tutorial Start 01:09 - Coding Start
@MetalStormGames
@MetalStormGames 3 жыл бұрын
Very helpful. I am trying to learn the new input system and just slowly expand on it instead of diving right in and this is exactly what i needed.
@random_precision_software
@random_precision_software 3 жыл бұрын
I love coMing across new channels(to me anyway) and can't wait for more content! Subbed!
@natedizzy4939
@natedizzy4939 4 жыл бұрын
omfg so many bad tutorials that do not teach you ANYTHING about using the system. i just finished a tutorial that was 20 minutes and 2 full (dense af) pages of code to do what you did in a few lines. and that one didnt even work properly. on top of that it was very difficult to keep up with what was happening in the code...also actually explaining what you do and why helps a lot too. thank you!
@TheEquilibrium66
@TheEquilibrium66 3 жыл бұрын
Thank you so much, i was going to be crazy about new input system ( i'm new to programming) and finally i found a clean and correct way to do things, thank you again!
@spectralspace8866
@spectralspace8866 4 жыл бұрын
i have watched tutorials about new input system. Now i learned after I've watched this!.
@haachamachama7
@haachamachama7 3 жыл бұрын
Man, I understand why they made this new input system, as it's a lot more versatile, but it's not very easy to figure out on your own lol, wow, what a confusing system! I've been using the old system for the past year, just started a job where the team was using the new system, I spend hours trying to figure it out, even looking at the code they used for movement, I had no clue it could be done this way. Thanks for the tutorial.
@puppamilaspranga
@puppamilaspranga 4 жыл бұрын
this is such a useful video... i'm a noob at coding and all the videos i found are so hard to understand. I tried different videos and different methods with the "callbacks" but none of them worked. I'm so grateful
@sasakiluna
@sasakiluna 3 жыл бұрын
i made the move speed a public float so it is easier to optimize. great tutorial helped a lot.
@dmtuan
@dmtuan 4 жыл бұрын
It's quite useful to have the ability to assign key bindings in the Inspector in the script. Didn't know you can do that. Thanks!
@lee1davis1
@lee1davis1 4 жыл бұрын
Put this in my unity must watch playlist. Great job simplifying this.
@foresking6562
@foresking6562 3 жыл бұрын
9 minute video with 9 minutes of good content. great goob my dude. U made this problem of mine became barelly a inconvenience. NICE
@betterwithlasers
@betterwithlasers 4 жыл бұрын
really helpful, the axis swapping was a lifesaver!
@swannschilling474
@swannschilling474 4 жыл бұрын
Thanks for showing how to fix the vector bug...was trying to figure out how, and by luck found your tutorial!!
@AetherXIV
@AetherXIV 4 жыл бұрын
You made the absolute simplest tutorial I've been able to find on this topic. Thank you so much. Would you be interested in making another video, or leaving a comment, on how to add button commands? I know its a "binding" but I can't figure out how to access the bindings I made in my script.
@AsciiKing
@AsciiKing 3 жыл бұрын
Beautifully simple. Thank you so much.
@marc-antoinegirard2178
@marc-antoinegirard2178 4 жыл бұрын
Very helpful tutorial! Actually also helped me with Rewired :)
@dotNets
@dotNets 4 жыл бұрын
Keep doing what you do man, you just got a new Subscriber :)
@Devsplorer
@Devsplorer 4 жыл бұрын
Enjoyed and appreciated the tutorial! Thanks :)
@sangeetsargamsagar4639
@sangeetsargamsagar4639 3 жыл бұрын
5:58 what exactly is controller.Move() ? Is that a predefined function of the new inputsystem
@RumpledCode
@RumpledCode 3 жыл бұрын
That is a method given by the Character Controller component in Unity :)
@sangeetsargamsagar4639
@sangeetsargamsagar4639 3 жыл бұрын
@@RumpledCode oooooooooohhh... Okay... Btw, sir are you on instagram!?
@RumpledCode
@RumpledCode 3 жыл бұрын
@@sangeetsargamsagar4639 I have a company instagram double_lens_vr :)
@Movie-Space_
@Movie-Space_ 3 жыл бұрын
thats such a good video but i didnt understand when you called the input so i dont now how to make my player to shoot using this plz someone help
@SaSeshen
@SaSeshen 4 жыл бұрын
You are perhaps the only video out there that actually uses mouse movement in their tutorial for the Input System, however I have a couple questions. What is delta vs position for the mouse input? How do I use a system in which it is just a move on click, ie. I right click on the screen and my player moves there? What is the purpose of the Player Controller Component (does it save us some code writing?) I will say this though creating a script that lets you build a custom action map from the editor was something I hadn't seen and is absolutely genius!
@tikokito5778
@tikokito5778 4 жыл бұрын
Thank you Bro. Awesome tutorial. simple and good!
@samgraham5731
@samgraham5731 3 жыл бұрын
Great tutorial, thanks. Focused and concise. Music was a little distracting.
@29480pete
@29480pete 3 жыл бұрын
Can I just ask something? Why didn't you include the tutorial on jumping?
@pliniomourao
@pliniomourao 3 жыл бұрын
Could you add a Part 2 using Mouse Left button, RMB?
@HeadPack
@HeadPack 3 жыл бұрын
Super valuable. Thank you very much.
@GrenadierPete
@GrenadierPete 4 жыл бұрын
Never knew about this technique! Nice!
@klkellychan
@klkellychan 3 жыл бұрын
I got an error "NullReferenceException: Serialized Object of SerializeProperty has been Disposed", may I ask where did that come from? Thanks!
@supser7827
@supser7827 3 жыл бұрын
how to make this in a if statement. If pressed c debug.log("hi").
@Movie-Space_
@Movie-Space_ 3 жыл бұрын
yeah i need help on this too
@mboe94
@mboe94 3 жыл бұрын
Do you not use the input manager at all? Everything through the script?
@tntclan65
@tntclan65 4 жыл бұрын
I don’t get the wasd input do you know how to fix this 2:05
@4ndresC
@4ndresC 4 жыл бұрын
Why don't you have to instantiate the InputAction object?
@n8dev
@n8dev 4 жыл бұрын
Really great tutorial! Although at the beginning when you use public variables to serialize your values in the inspector, that is actually really bad practice, in OOP you should try to abstract as much as you can; other classes should only be able to see what they need to see, so using [SerializeField] would be much better in this case
@manasjoshi5957
@manasjoshi5957 2 жыл бұрын
Great video man 👌
@Faisal-jo5vk
@Faisal-jo5vk 3 жыл бұрын
how do i make it jump?
@tuxdoesstuff
@tuxdoesstuff 3 жыл бұрын
how about for bindings?
@johncardussi
@johncardussi 4 жыл бұрын
2 questions: 1) The mouse was moving way faster than the keys. To fix that do you create another InputAction for the mouse so you can use a different speed value? 2) Is there a way to redefine the keys so players can customize their controls to say use the arrow keys?
@GwynPerry
@GwynPerry 4 жыл бұрын
I haven't tested this, but when you set up a binding you have the option to add Interactions and Processors. Under the Processors, there are options to scale and clamp the input, amongst others. I'm guessing some combination of these can be used to adjust the mouse sensitivity.
@juten6020
@juten6020 3 жыл бұрын
I'm lost. This is a great way to use the new inputsystem for movement. However, for normal functions, I'm kind of lost. Could someone help with this? For example, if I wanted to make an attack button, how would I do this?
@jamesflips6213
@jamesflips6213 3 жыл бұрын
To reference a single button, you first add it to the OnEnable and OnDisable functions just like you did with wasd. In the Awake function, you can write attack.performed += _ => Attack(); this will allow you to create a function that is called when you press the binding for the attack action. For example, if you were to write void Attack(), then you can create a bool called attacked and set it to true in this function. Finally, in the update function you can write: if(attacked) { (attack code) attacked = false; } something like that allows you to have an attack ability, but you'll have to figure out how to write the actual attack code on your own because I have no clue how lol. Hope this helps!
@jamesflips6213
@jamesflips6213 3 жыл бұрын
nvm its as simple as writing if(attack.triggered) in the update function lmao
@hiddenworlds225
@hiddenworlds225 4 жыл бұрын
Great video! I know this is a bit off-topic, but where did you get the material for the floor? I see people use it, but I could never find it.
@wadeeliason969
@wadeeliason969 4 жыл бұрын
The grid material is from the pro builder asset
@hiddenworlds225
@hiddenworlds225 4 жыл бұрын
thx. Thought it looked familiar.
@wadeeliason969
@wadeeliason969 4 жыл бұрын
Hidden no prob
@rakibulalam277
@rakibulalam277 4 жыл бұрын
I did the same thing as you. but when I press w or s it moves along y Axis. Please Help
@videosifoundontiktok9248
@videosifoundontiktok9248 4 жыл бұрын
Can u make search autocomplete System?
@yuukivm
@yuukivm 3 жыл бұрын
This is the best tutorial :)
@Kilgorio
@Kilgorio 4 жыл бұрын
How to animate player with this?
@AtelierMcMuttonArt
@AtelierMcMuttonArt 4 жыл бұрын
Wait, what? How were you able to alter the finalVector's individual axes in C? Whenever I try that, it throws an error, saying that it can't be modified because it isn't a variable.
@gabrielaguiar5984
@gabrielaguiar5984 3 жыл бұрын
Input.GetAxisRaw("Horizontal") how I can make this in New input System?(i think is 1D but, im not sure how to use)
@saiverx
@saiverx 4 жыл бұрын
I guess I haven't spent too much time staring at my code yet, but my input is only detected for a split second. I dont know what it is that cancels out my input, but I did check the input using the debug.log method and it only detects me holding the button for a few frames/a split second. Any ideas on a fix? I really dont understand what could be causing this, seeing as it is the first line of code inside the Update void...
@saiverx
@saiverx 4 жыл бұрын
Here`s the solution: I had set the Action Type to "Pass Through" and not "Value". Setting it to Value fixed it for me. :) Altough it has worked perfectly as pass through but suddenly it stopped working. That's when I sought to a tutorial such as this one to find my error.
@taltra9922
@taltra9922 4 жыл бұрын
Thank you for the video, it is the only tutorial that worked for me. But can you upload your project somewhere? My game prototype works but in the console I get literal hundreds of errors. MissingComponentException: There is no 'CharacterController' attached to the "Input" game object, but a script is trying to access it. You probably need to add a CharacterController to the game object "Input". Or your script needs to check if the component is attached before using it. I checked and there is a controller attached to my object
@nickname9976
@nickname9976 3 жыл бұрын
When I click on the path nothing pops up Pls HELP!
@elinal9985
@elinal9985 4 жыл бұрын
Your naming conventions hurt me
@xLester13x
@xLester13x 4 жыл бұрын
helped me a lot!
@MrMrMrPresident
@MrMrMrPresident 4 жыл бұрын
Hey, I was wondering about whether you think this input system would be good if you are planning to allow players to rebind keys, or maybe this is only good for prototyping.
@RumpledCode
@RumpledCode 4 жыл бұрын
I'd use it for that, for sure :) I'd say you'd be able to make it relatively easily.
@MrMrMrPresident
@MrMrMrPresident 4 жыл бұрын
@@RumpledCode Awesome! Thanks for the video
@Art_Studio_Figma
@Art_Studio_Figma 4 жыл бұрын
i followed your steps .. but still its not moving ...plz help me to solve this
@Erbmon
@Erbmon 4 жыл бұрын
I mean this takes like 2 clicks and 2 code lines in godot or unreal, why unity why?
@070tahsin
@070tahsin 4 жыл бұрын
Does this code also work on a android device where you can swipe the player to left and right
@DanA-ux6ow
@DanA-ux6ow 4 жыл бұрын
Yes
@CanCodeyt
@CanCodeyt 4 жыл бұрын
I did everything you said and my character is still going upwards
@green0_020
@green0_020 4 жыл бұрын
Because in line 19 you need to type OnDisable(). He wrote OnDisalbe()
@CanCodeyt
@CanCodeyt 4 жыл бұрын
@@green0_020 ohhhh
@toxicaristotle3052
@toxicaristotle3052 4 жыл бұрын
somebody help with crouching to idle animation with the new input system
@FM_GOBi
@FM_GOBi 4 жыл бұрын
How do I read a button press on a keyboard?
@RumpledCode
@RumpledCode 4 жыл бұрын
If you want something that is read only 1 frame: inputAction.triggered If you want to read it each frame, read the float value and check if it is greater than 0
@FM_GOBi
@FM_GOBi 4 жыл бұрын
@@RumpledCode I've figured it out. (Keyboard.current.wKey.wasPressedThisFrame) This is what I was looking for. Thank you kindly for the video and the comment, I've subbed! :) But this method isn't as responsive as I would like. If I press the buttons very fast, it doesn't update as fast as I am pressing.
@sanzjulio
@sanzjulio 4 жыл бұрын
Does it go along with nav mesh ?
@RumpledCode
@RumpledCode 4 жыл бұрын
I'm not sure how the input system and the navmesh are connected. Could you elaborate?
@sanzjulio
@sanzjulio 4 жыл бұрын
@@RumpledCode i want mY plaYer to recongnize a terrain with a nav mesh navigator . could i add a nav mesh agent to that plaYer.... thanks a lot!!
@RumpledCode
@RumpledCode 4 жыл бұрын
@@sanzjulio Yes but then I assume you'd want your player to be moved by mouse click or some other way of defining an end point for it's movement. So this tutorial isn't really for that. But yes, you can absolutely do it :)
@sanzjulio
@sanzjulio 4 жыл бұрын
@@RumpledCode thank You!!
@RumpledCode
@RumpledCode 4 жыл бұрын
@@sanzjulio Happy to help :)
@MrPrezDev
@MrPrezDev 4 жыл бұрын
This is OK method for tiny unimportant projects, but if you have a real game then you would be wise to learn to use the new input system properly.
@toxiq5295
@toxiq5295 4 жыл бұрын
My Unity wont show me InputAction so I can type it in but then nothing happen D:
@RumpledCode
@RumpledCode 4 жыл бұрын
Have you added the Input System package from the package manager?
@toxiq5295
@toxiq5295 4 жыл бұрын
@@RumpledCode yes I did and I can use it but in the script unity won't use the function InputAction
@RumpledCode
@RumpledCode 4 жыл бұрын
@@toxiq5295 Not sure what the issue is from your comments. Try creating a new project and following along the tutorial step by step.
@toxiq5295
@toxiq5295 4 жыл бұрын
@@RumpledCode I made a new project now it works ty probably just deleted something
@RumpledCode
@RumpledCode 4 жыл бұрын
@@toxiq5295 Happy to help :)
@KeeCity
@KeeCity 4 жыл бұрын
Bravo!!!
@b03tz
@b03tz 4 жыл бұрын
I don't think your "OnDisalbe" function will do alot! :)
@RumpledCode
@RumpledCode 4 жыл бұрын
Your opinion is correct :P
@b03tz
@b03tz 4 жыл бұрын
@@RumpledCode :D
@prathammittal
@prathammittal 4 жыл бұрын
Nice :)
@RumpledCode
@RumpledCode 4 жыл бұрын
Glad you liked it!
@Kilgorio
@Kilgorio 4 жыл бұрын
wow
@wadeeliason969
@wadeeliason969 4 жыл бұрын
Very helpfull
@paulbunyangonewild7596
@paulbunyangonewild7596 3 жыл бұрын
This! Stuff! Doesnt! Work! Why!
@paulbunyangonewild7596
@paulbunyangonewild7596 3 жыл бұрын
Oh Thank God. FINALY!!! Adding in the enable line made it work.... thank you so much.... even though it feels redundant I can see how it would help developers not have all their control methods active at once. All this time I thought it was just being fussy about the value type and what have you.
@v.037
@v.037 3 жыл бұрын
BRUH
@kreativekendi4267
@kreativekendi4267 3 жыл бұрын
666th subscriber
Why you should switch to Unity's New Input System (and how easy it is)
9:51
Jason Weimann (GameDev)
Рет қаралды 34 М.
I Beat Minecraft From One Grass Block
35:27
Beppo
Рет қаралды 7 МЛН
Unity's New Input System:  The Definitive Guide
32:07
DmanGames
Рет қаралды 38 М.
The simplest way to use Unity "New" Input System
6:40
PitiIT
Рет қаралды 34 М.
How to use Unity's New INPUT System EASILY
9:32
BMo
Рет қаралды 253 М.
Unity Tutorial - Simple Character Selection System
5:30
RumpledCode
Рет қаралды 91 М.
CONTROLLER INPUT in Unity!
16:44
Brackeys
Рет қаралды 377 М.
How to use Machine Learning AI in Unity! (ML-Agents)
44:51
Code Monkey
Рет қаралды 517 М.
Mapping Inputs to Actions in Unity VR!
7:18
Fist Full of Shrimp
Рет қаралды 7 М.
КОРОЧЕ ГОВОРЯ, НЕДЕЛЯ БЕЗ ТЕЛЕФОНА
3:54
НИКОГДА не иди на сделку с сестрой!
0:11
Даша Боровик
Рет қаралды 729 М.
Абзал неге келді? 4.10.22
3:53
QosLike fan club
Рет қаралды 31 М.
#trending #foryou #challenge #fyp #viral #short #tiktok #vs
0:15
Misiсatсh
Рет қаралды 2,4 МЛН