Unity's "NEW" Input System with C# Events

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024

Комментарии • 254

  • @HorizoneMeNol
    @HorizoneMeNol Год назад +51

    If you're following this tutorial and can't find yourself a 2d composite
    please note that unity input 1.3.0 or above, has wrap up the composite creation
    on Movement(green tab) select action type from "button" to> "Value" and underneath controltype to "Vector2"
    now when you right click on green tab
    it will show up/down/left /right composite which is the same in this video
    and you will be needed unity input 1.1.0 or above for key rebinding later on

  • @amieldanao968
    @amieldanao968 2 года назад +14

    The problem with the unity new input system is that they dont know how to make a tutorial like this. Thank you very much sir, bravo!

  • @steveradtke1308
    @steveradtke1308 2 года назад +6

    I have watched 2 other guides on the new input system (I only just upgraded to it) and this is the best tutorial I have come across. Thank you.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +2

      Glad it helped! Do check out the whole playlist with a bunch of applications of the new input system ;)
      ruclips.net/p/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk

  • @CosbyKong
    @CosbyKong 3 года назад +10

    Just a part way in and I can see a few things, this video is updated with new information unlike others that are heavily outdated with experimental information, the information is concise and honest / straight to the point that this new system is more complex, and its heavily detailed with suggestions of where else to look for further information with the video broken into sections. Subbed! Keep up the videos, these are really really well made.

  • @pi-or-die
    @pi-or-die 3 года назад +12

    you can use the entire "left stick" if you set the action to "passthrough" and "Vector2". Works really well for capturing those angled movements!

    • @MQNGameDev
      @MQNGameDev 3 года назад +3

      You can also use a Vector2 Value Action type with Composit2D binding for WASD(Tip: create a 2nd composit2D and drag bindings up to 1st one and bind arrow keys then delete empty one), and a left stick(Gamepad) binding. This is how the Unity team set up their InputActions for their free: 'Starter Assets Third Person Character Controllers' asset.

    • @ng1048
      @ng1048 2 года назад +1

      What are you guys talking about. I cant understand! Just learned some c# sharp basic when came across this..

    • @travisstanley7016
      @travisstanley7016 2 года назад

      @@MQNGameDev This. Thanks!

  • @exhilex
    @exhilex 5 месяцев назад

    Thank you for putting out a wonderful tutorial that explains very precisely, without confusion the new and rather complicated Input System! Not only that, you also explain why the new Input System is superior in some cases!
    Thank you very much for freeing us from the pain of confusion of the new input system!

  • @_jonathancollins
    @_jonathancollins 5 месяцев назад

    2 years later, and this tutorial is still a life saver.
    Thanks!

  • @Any1SL
    @Any1SL 3 года назад +1

    Adding a gamepad on the old system is super simple. Took 5 minutes and no additional code after watching a tutorial on RUclips. But this is still a good tutorial.

  • @VirtualTurtleGames
    @VirtualTurtleGames 3 года назад +5

    SUCH a good tutorial! Really clean and easy to understand, thank you! I'm super glad they built this new system as it keeps the code much cleaner and allows for a lot of flexibility in your game's input.

  • @littlearvin1641
    @littlearvin1641 2 года назад +7

    I have been learning this system for 2 days. I've seen some people using the Player Input component. Which made it even more complex & vague.
    Your explanation and way of doing it, is the best I've encountered.
    Thank you for your time & effort. :)

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +4

      The player input... Didn't like that at all. Felt like a magical black box. Glad the video was helpful!

  • @corygreaves1227
    @corygreaves1227 3 года назад +4

    Just watched your Delegates, Events, Actions and Funcs video and this back to back and you sir, have a new subscriber. I'm trying to switch over from using the OVR input system for my first VR game and almost had a heart attack when I realised what I'd have to do to use this, but I can see how this method would clean up code across the whole project. Thank you!

  • @lilyflowerangel
    @lilyflowerangel 2 года назад +2

    Best explanation I've encountered so far. Although it wasn't what I was looking for, it does shed some light on the input system itself. Now I just have to figure out how to do this with complex UI scenes like main menu n all that.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      UI is another thing for sure! Getting basic button clicks and such to work is pretty easy, but I'd definitely like to get deeper into some of the functionality. Glad the video was useful!

  • @cathalmccosker
    @cathalmccosker Год назад +2

    Thanks for the walkthrough. I was using the C# events as regular events and was getting severe performance issues. I didn't know I had to use farmerInputActions.Disable() on OnDisable() for the new InputSystem. You don't have to do that for each event [e.g. farmerInputActions.Player.Jump.Disable()], just for the input mapping file itself [farmerInputActions.Disable()]. Great video!

  • @heavymetalhamster7111
    @heavymetalhamster7111 3 года назад +1

    I just wanted to leave my "Thank you for this great explanation!" here. Will watch your other videos as well, I really like how you explain things.

  • @ZeroChronicles01
    @ZeroChronicles01 3 года назад +2

    I'm very grateful for this video! at the start of the month I decided to get back into making my own game again, but I put a lot of time into learning the old system and gotten use to it really well. But coming back after a year, and seeing how many people are pushing for the new system, I wanted to try and learn it and use it. How ever, it was kind of over whelming, and a lot of tutorials I tried to look up didn't really explain what a lot of the systems did (example : the action types), and I just got frustrated and stopped trying to make my game. Today I said "To heck with it" and i was going to use the old system. Before I did I decided to look up tutorials for the new system one last time just in case . Your video came up and I gotta say THANK YOU! Your tutorial was much more straight forward, and easy to understand , even more so when you explained each part did . Again, thank you so much!
    Edit :
    I would really like to see a tutorial on "Tank Controls" with the new input system ! I understand WASD movement, but I always liked the resident evil style control type, and I always wondered how I could use that as well. Or to be more precise , using A and W to rotate the character , and using W and S to move forward and backwards. I could never find a good tutorial on how to make my own, both in 2d and 3d games. Could you cover that controller type in the future some time please? I would love that!

  • @Miale_of_the_Void
    @Miale_of_the_Void 3 года назад +1

    Thank you for this video! I had been wracking my brain trying to understand how to make this work and other videos I found were using the older version which was more confusing than anything! Thank you again!

  • @mg1632
    @mg1632 2 года назад +3

    Thorough walkthrough of the new input system. I stumbled upon this after fighting for 6 hours through the unity documentation which has dozens of disjointed code snippets, screenshots, and code explanations that culminates into a failure to convey any cohesive usage of their own system. HUGE Thank you for the time and effort you put into this!

    • @Keanine
      @Keanine 2 года назад +3

      It's actually surprising how bad the documentation for the new input system is. Unitys standard documentation is usually so clean, precise and has clear examples so it's weird to see it so messy

  • @neorevolutionnar
    @neorevolutionnar 2 года назад +3

    super clear explanations and i feel like i'm starting out with the complete toolbox with this system. Thanks a lot man

  • @dannybrez
    @dannybrez 2 года назад

    Upon watching your Key Rebinding I realised from this video I didn't generate my C# script, I was going crazy! I have to say though your videos are super helpful and I am 100% going to be watching more. Thank you :)

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      Glad they’re useful! Stop by the OWS discord and ping me if you have questions or get stuck.

  • @goldkat99
    @goldkat99 3 года назад +1

    Great video, loved it. Just complex enough to get the full picture but not overly complicated and confusing for someone of intermediate skill level.

  • @kykilli3126
    @kykilli3126 3 года назад +26

    great tutorials, probably one of the much better ones Ive seen over the past 6 years.

  • @HTMLlama
    @HTMLlama Год назад

    Thank you thank you thank you! I've watched hours of videos on the new system and this is the first one that made it all click.

  • @Macellomatik
    @Macellomatik 3 года назад +1

    Thank you so much!
    I used this system in 3 different ways and always felt like it was not the right structure... I finally connected the dots with this video.

    • @bigggmoustache8868
      @bigggmoustache8868 2 года назад +1

      After official tutorial and a few YT tutorials I'm here. I hope this does it for me too! xD
      Edit: Still feel super dumb. Now for another tutorial. >.>

  • @jamesstephenson4544
    @jamesstephenson4544 2 года назад

    I have tried so many different videos the last few days to get the new input player. So thanks and I will be subscribing.

  • @PcKaffe
    @PcKaffe 2 года назад +1

    I'm still not sure if I like the new input system, but I am sure that I do like your explanation of it. Thanks for the video!

  • @bigmancozmo
    @bigmancozmo 2 года назад +1

    thx i can finally port my game over to the new input system and now i can play with controllers

  • @SharkySSharkington
    @SharkySSharkington 2 года назад +21

    There's no "Add 2D Vector composite" option now. The only options are "positive/negative binding" and "binding with one modifier" and "binding with two modifiers". Currently on Input System 1.2.0 How do I proceed?
    UPDATE: It seems having that option was a bug as it shouldn't be available for button actiontypes.
    UPDATE 2: If you select "Value" Action Type and "2D Vector" as control type you have the "left/right/up/down Composite"

    • @AmallieGames
      @AmallieGames 2 года назад +3

      Omg thank you, this confused me but I found it thanks to your edit 2 :D

    • @XxLocodragonxX
      @XxLocodragonxX 2 года назад +2

      Thank you so much

  • @panda_unleashed1222
    @panda_unleashed1222 2 года назад

    Maybe I'm a little late, or it was said allready - but - I think the Gamepad Left Stick/Left - problem mentioned around 9:20, you can solve that issue by choosin Movement - Action Type "Value" instead of "Button". Then it should give you the oportunity to choose assign Gamepad Left Stick natively. Thank you for that nice and quick tutorial. Sorry for the crappy english xP kind regards and happy learning everyone.

  • @mikemcghee4750
    @mikemcghee4750 3 года назад +1

    Great Video! Just wanted to say thank you, as this got me a format that actually posted through as I wanted. Been banging my head on getting it working for weeks.
    Great teaching style too; you've got a patron. Keep 'em coming!

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      So glad the video helped. And a sincere thank you for the support on Patreon! If you've got questions, or something I can help with don't hesitate to reach our and or join the OWS discord.

    • @yokj9081
      @yokj9081 3 года назад

      @@OneWheelStudio excuse me I have some unity question. somebody can help me?I am Taiwanese so my English is not well.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      There’s a link the OWS discord in the description you’re welcome to pop over there and ask a question.

  • @rungy8214
    @rungy8214 Год назад

    Thank our Father in Heaven for you sir!!! FINALLY someone explained the Input System the way UNITY SHOULD HAVE DONE IT!

  • @JaysOnTheMoon
    @JaysOnTheMoon 3 года назад +1

    Great video! Been toying around a bit with trying to understand how it functions compared to Rewired. I would love to see more on the new Input System.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      Anything in particular you’re interested in seeing?

    • @JaysOnTheMoon
      @JaysOnTheMoon 3 года назад +2

      ​@@OneWheelStudio Interaction w/ UI is a topic I'd like to see some coverage on.

  • @TheGabmeisterX
    @TheGabmeisterX 3 года назад +3

    Thank you for these great tutorials. Your explanations are easy to follow.

  • @BrianLindahl
    @BrianLindahl 3 года назад +1

    Loved the video. Been struggling for some time with the new Input System. I would love more videos seeing how it works with Touchscreen and UI... My 2 cents.

  • @Nova04550
    @Nova04550 2 года назад

    Thank you! I just wanted to hook into the new input system through C# events, and you got me there! The documentation is so confusing.

  • @jakubstacho9199
    @jakubstacho9199 3 года назад +1

    Great tutorial, everything in one place, clear, that's it!!! Thanks, keep it up

  • @dolguldur1833
    @dolguldur1833 4 месяца назад

    straight to the point. very nice tutorial, thanks!

  • @mayankbhaisora2699
    @mayankbhaisora2699 2 года назад

    Just came across your channel and I love your videos. You explain everything properly. Thank you mate. 🖤

  • @chaosmastermind
    @chaosmastermind 2 года назад +7

    The dropdown menus on the control schemes are slightly different now.
    I had to use Action Type : Value, Control Type: Any and then "Add Up/Down/Right/Left Composite to get the WASD key bindings set up.
    This tutorial is only a few months old and it's already slightly off. :D

    • @soycowdoy
      @soycowdoy Год назад +2

      Life saver! Ty

    • @Robocat754
      @Robocat754 Год назад

      Select value and control type to be vector2 will also get us the WASD binding

  • @devong1838
    @devong1838 3 года назад +1

    Perfect amount of thorough, thank you so much

  • @halivudestevez2
    @halivudestevez2 2 года назад +2

    very nice tutorial! thank you very much for it!

  • @halivudestevez2
    @halivudestevez2 2 года назад +1

    after += press double tab, event handling method will be generated

  • @isjesse1
    @isjesse1 2 года назад +1

    4am, i final got i figured out, thank you sir, im going to bed

  • @OfficialMageHD
    @OfficialMageHD 3 года назад +3

    Welp, I've already been working to cleanup my visual scripts, might as well put in the bit of extra effort and swap to the new input system. Then I can avoid worrying about touch vs mouse input as much.

  • @betadv
    @betadv 2 года назад

    I watched 20 fucking tutorials on the New Input System, this is the Only one I understood. ;D
    Thanks.

  • @ernestj8000
    @ernestj8000 2 года назад

    Excellent explanation and walkthrough. Thank you for posting this.

  • @diliupg
    @diliupg 3 года назад +1

    Great professional way of teaching. Thanks. subscribed!

  • @dogsnout
    @dogsnout 2 года назад

    You explained this perfectly. Thank you so much!

  • @TheLegendsOfTynedale
    @TheLegendsOfTynedale 2 года назад +1

    I would like to know how to let the player customise the controls. That they can change the shoot button from say X to Y or from Space bar to the Enter key.
    Otherwise, an excellent tutorial and presentation style. Clean and concise with solid modelling.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      I've got a video on rebinding keys. Should get you headed in the right direction. Link: ruclips.net/video/TD0R5x0yL0Y/видео.html

  • @karolr8469
    @karolr8469 3 года назад +1

    For me a video where you create players dynamically and assign gamepads/keyboard for them would be something interesting 👍

  • @citan554
    @citan554 2 года назад

    This was very concise and helpful, thank you! I've subscribed on Patreon

  • @m_maksym
    @m_maksym 2 года назад +1

    please make more videos about this new system. very interesting! a day ago tryed to make a in-game zoom(by changing fov when right mouse button is held and unzoom when released) but failed and in few lines made it on ols systen)

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      I've got a playlist with more videos. ;) I'm also working on a split screen video at the moment. Playlist: ruclips.net/p/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk

    • @m_maksym
      @m_maksym 2 года назад

      @@OneWheelStudio +1 subscriber)

  • @PontonFSD
    @PontonFSD 3 года назад +8

    I'd find it interesting to see how the new Unity Input system might be used for like a fighting game style of input. Where it recognizes that doing a quarter-circle motion plus an attack button performs a 'special move'

    • @JohnnyThousand605
      @JohnnyThousand605 2 года назад +1

      Short answer: it's really hard. I've got something working and it's flexible enough that I can add new special moves easily (using scriptable objects) , but the reading/parsing of inputs is tricky. How do you handle charge moves? How do you handle moves that require multiple buttons simultaneously (so Forwards + Punch for example)? Then you need to think about the direction the player is facing. O_O None of these issues by themselves is, well, an issue; but keeping all the balls in the air at the same time is the tricky part. How you want your fighting game to play may make some situations a non-issue (for example, if your game won't have Lightning Kick/Hundred Hand Slap style moves, you won't need to check for rapid tap inputs) It's all possible and I'm very confident better devs than me would have better solutions. Oddly enough the actual "do these inputs match this special move?" is relatively straight forward, the hard part is not having the incoming inputs turn into an incoherent mess

    • @PontonFSD
      @PontonFSD 2 года назад +1

      @@JohnnyThousand605 yeah, I know it isn't out of the box easy. Best I've done ATM is get all my inputs to report into a byte each frame. I have four directions and three buttons combining to form the single byte. So if you were to see the byte as 8 bits, pressing left and punch would be 00100100 and down plus punch plus kick would be 01100010. Recording each frame within a limited array, combined with pop and pushing can see a history of inputs per frame. Then the moves you can issue a requirement of a set order with a number of frames accepted between specific input changes I expect. So something like quarter circle forward might be looking through recent inputs for 00000010 and then looking for 00001010 within 20 frames, if checks then look for 00001000 within another 20 frames, and say the punch can be registered up to a second later so 00100000 within 60 frames. Can be further divided by just checking first half byte for directionals and last half byte for buttons. In case where the buttons are allowed to be pressed during inputs? Dunno. But at least I think it might be workable from there.

    • @JohnnyThousand605
      @JohnnyThousand605 2 года назад

      @@PontonFSD Nice. That looks like a solid way of doing it. I'm guessing because you're using bytes it's very performant? The way I've done it is to create an enum called InputButton that can be Neutral, UpForward, Forward, DownForward etc, then made a ComboInput class that holds an InputButton variable (set in the inspector) and a function in the ComboInput class that takes an InputButton argument and returns true/false if it matches its own InputButton. Each move ScriptableObject then has an array of these ComboInputs and I can set the sequence of InputButton enums in the Inspector. There's an InputChecker class that holds a list of all the special move ScriptableObjects, sends out the current input to be checked to the special moves and receives a response from each. Any that return false (ie, the input is not that special move's next valid input) are relegated until the next frame, but if a move reaches the last of its valid inputs it triggers the actual special move. This is a proof of concept/demo bitglassgames.itch.io/block-fighter

    • @darshandev1754
      @darshandev1754 2 года назад

      @@JohnnyThousand605 block fighter is not working on mac bro

  • @jahoopyjaheepu497
    @jahoopyjaheepu497 3 года назад +3

    This was an extremely well-explained tutorial. I'm probably going to stick with the traditional input system since I'm only using a few very simple button presses, but this is worth looking into in the future.

    • @SWFGaming
      @SWFGaming 2 года назад +2

      Same here

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      I do think for simple implementations especially for keyboard and mouse there is no real reason to migrate to the new system.

  • @jaxowaraxa
    @jaxowaraxa 3 года назад +1

    Instead of subscribing directly to each action please use SetCallbacks which are ready for you inside your generated c# class. Great tutorial but I would like to see more in-depth tricks because like you said more of the videos do that.

    • @jaxowaraxa
      @jaxowaraxa 3 года назад

      @@OneWheelStudio I'm not sure but one day I checked Unity open project and they use it in some nice way maybe you can find something interesting there for new video because they constantly creating this project. Also I try to do some Vector button on int but I think there is no option for that and I must cast from float or made separate two actions or I just cant handle this.

  • @hernandonj
    @hernandonj 2 года назад +1

    awesome video! thanks a lot!

  • @julianmjk5120
    @julianmjk5120 2 года назад

    Unity 2020.3 can now be used with the new Input System, it was recently updated :D

  • @li0nleo918
    @li0nleo918 3 года назад +1

    thanks for this video all the other explanations i found online used that player input behavior which never works for me.

  • @canuniverse3367
    @canuniverse3367 3 года назад +1

    finally a worthy tutorial

  • @moltebergk
    @moltebergk 2 года назад

    This helped me a bit on the way. I would have found it a lot more useful if you had split the video into two parts, one for a general explanation of the input system and another where you go into more detail about subscribing to c# events. For instance, as of this point I'm still not sure how to subscribe to an action without directly subscribing to the phase through c# events.

  • @martincalander
    @martincalander 3 года назад +2

    you are really good content, keep up good!

  • @amrosk
    @amrosk 3 года назад

    Nice concise tutorial, a tutorial on alternating Action Maps would be grate, also, switching key binding at runtime like in a settings menu.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      Both great topics - definitely needed if the system is going to be used in a production project!

  • @vandende
    @vandende 2 года назад +2

    Can you make a video how to trigger ui buttons in unity using the new input system with keyboard and gamepad. I am asking because i got really trouble using the gamepad there. The ui button looses the focus and the on click default event of the button is not raised using the gamepad. Using the keyboard is not a problem. I turned off the mouse control at all. That is because my game is foreseen for mouse control. But on top when mixing mouse and gamepad then will the the gamepad trigger the ui button only as expected when the mouse pointer is on the buttons position. Otherwise the button just loose focus because the mouse button is outside a user control area. But when turning off the mouse and also ensure in code that any ui control is focussed always, it will losse still the focus by triggering the gamepad button to raise the on click event of the ui button. Would be perfect to see such video how to control ui buttons and ui toggles checkboxes.

  • @prenomnom6300
    @prenomnom6300 3 года назад +1

    thank you so much!

  • @BlackJar72
    @BlackJar72 2 года назад

    My experience with the new input system so far is that it caused the fans to start whirring on my 3900X while producing choppy, erratic movement that just felt lag-tastic.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      That’s definitely strange and seems like something is wrong. If anything performance should be a bit better as you don’t have to poll inputs every frame. If you’ve got code that you know is causing the issues feel free to drop by the OWS discord and share it. I’d be interested to see what’s going on.

  • @crookeddream
    @crookeddream 3 года назад

    freaking great tutorial. exactly enough.

  • @codycanipe4415
    @codycanipe4415 4 месяца назад

    Hey there, is there a simple way to modify the action processors via script at runtime? For example a ScaleVector2 for a camera input. I can't find a solution that is working for me. Also, i am using the Cinemachine Input Provider with a CinemachineFreeLook camera if you know about any restrictions in this context.
    Great video as always and thanks!

  • @hainguyenthanh9227
    @hainguyenthanh9227 3 года назад +1

    Update: On verified verion 1.0.2, touch's release does not recognize inside game view. On preview 5 version 1.1.0, touches does not even get recognized T~T.

  • @cloudwolf3972
    @cloudwolf3972 3 года назад +2

    Hey, I'm new here and I have a question:
    I found how to create a input action with a modifier(Shift) which is Shift+Right Mouse Button, but now my other action with only Right Mouse Button(no mods) is also triggering at the same time. How to I prevent my RMB action to trigger when I use my Shift+RMB?
    And thanks for all the content about the New Input System, its been really helpful.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      Hmm. This isn't something I've dealt with yet. So I did some research. From what I can tell is Unity hasn't resovled this problem!!! There are work arounds. Here's one that seems to make sense and I've seen others reference. If you find a good solution I'd love to know what it is.
      Link: stackoverflow.com/questions/65546739/new-unity-input-system-is-there-a-way-to-not-execute-an-action-if-a-modifier-i

  • @jaybenton7716
    @jaybenton7716 3 года назад +1

    Loved this.

  • @Frenotx
    @Frenotx 3 года назад

    On the subject of the video itself, it would be nice to see a demonstration of how to work with swapping between different action maps, when using the C# events approach instead of the built-in controller. I had a good bit of difficulty with that in one of my projects.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      Done! ;)
      Try this video: ruclips.net/video/T8fG0D2_V5M/видео.html

    • @Frenotx
      @Frenotx 3 года назад +1

      @@OneWheelStudio Sweet. Looks like a nice clean approach. Thanks.

  • @OneWheelStudio
    @OneWheelStudio  3 года назад +1

    Blog post on the New Input System: onewheelstudio.com/blog/2021/5/8/unitys-new-input-system
    Version 1.0.2 of the input system was used along with Unity 2020.3
    ***See the conversation with Dave below, for a possible issue re unsubscribing.

  • @mecsimoto7010
    @mecsimoto7010 2 года назад

    Thas was a great tutorial!

  • @mohamedwaqqas
    @mohamedwaqqas 3 года назад +1

    Great explanation mate! Can you please create a video explaining how to use multiple interactions on the same input binding.
    Example: Jump on "Tap" and SuperJump on "SlowTap/Hold" both on the "space" key. Especially regarding, on how to update a value of a variable. Like, it should only be able to jump twice. I'm seeing an issue (bug or bad implementation?) where the value "jumpsRemaining" variable is the old one, instead of the current one, hence I end up jumping maxJumps + 1 instead of just maxJumps. I wonder if this is something to do with the event system itself using old values? But I am not sure on the keywords to research this problem further.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      These are great questions! The nitty gritty of the system is not simple that's for sure.
      I think a good starting point would be to look at the CallbackContext documentation. This is the type of the parameter that is sent in the event. I basically ignored it in the video, but you can get all kinds of info about the event from it. Link: docs.unity3d.com/Packages/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.InputAction.CallbackContext.html
      You may also read up on the interactions to create tap and or press and hold functionality. Link: docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Interactions.html?q=interactions
      Based on what you are describing you may also need to subscribe to multiple events - started, canceled and performed. When these events are invoked they can start or end timers that are then monitored and functions called based on the timer. For example if the time between started and canceled is short you do the short jump or if it's long you do the power jump.
      Hopefully one of those ideas gives is helpful and moves you in a good direction.

    • @mohamedwaqqas
      @mohamedwaqqas 3 года назад +1

      @@OneWheelStudio Thanks. I managed to stumble across the same docs you linked earlier today. The Update/FixedUpdate loop was running immediately after firing the event which would overwrite my variable. Fixed it by subscribing to multiple interactions like you pointed out and switched to using TriggerEnter2D which seems to fire something like an event(?), And is not dependant on being polled. I guess that's what you get for mixing event based systems will polling architectures...

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      Glad you got it working. The flexibility and power of the system goes both ways. Lots that can be done and lots that can be done wrong 😛

  • @Frenotx
    @Frenotx 3 года назад +1

    Really like your shirt. Any idea where you got it?

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      I do happen to know where I got it ;)
      Link: onewheelstudio.com/merch/

  • @D-Dev
    @D-Dev 3 года назад +1

    Please do more videos about Unity Input System, maybe one about using it with touch and gestures. ;)
    Question
    If you're add DoJump method to the Jump event in the OnEnable handler, then you shouldn't remove it in OnDisable handler?

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      In general, whenever I subscribe to an event in OnEnable I ALWAYS unsubscribe in the OnDisable, but in this case, when you call "Disable" on the input action the events will not be called and since the Input Action Asset is a local instance there's no risk of invoking the event when the object is disabled or destroyed.
      So I think you very much could unsubscribe, but it's not necessary.

    • @D-Dev
      @D-Dev 3 года назад +1

      @@OneWheelStudio Thanks for fast answer, but I think that in this case when object will be enabled again you invoke Jump twice because you subscribe it again in the same instance of farmerInputActions, or maybe i'm wrong. Nevertheless video was awesome and I can't wait next video about Input system. :)

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      @@D-Dev I think you are 100% correct!

  • @pedropc5824
    @pedropc5824 Год назад

    I love this channel

  • @everlastingmedia
    @everlastingmedia 3 года назад +1

    Key Combinations
    Timed Actions etc

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      It's on my list! Not sure when it'll happen, but its on the list ;)

    • @everlastingmedia
      @everlastingmedia 3 года назад +1

      @@OneWheelStudio Nice! Thanks for the effort

  • @azyjmexcuseokstop924
    @azyjmexcuseokstop924 2 года назад +1

    problem with this implementation : it doesnt use maps, and i'd like to use maps.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      What do you mean by "maps?" The system uses action maps?

  • @guille_sanchez
    @guille_sanchez 2 года назад

    @One Wheel Studio excellent video, as always! I have a question: in 15:05, why isn't the FixedUpdate() showing the values in the console continuously rather than on button pressed?
    What I'm trying to accomplish is to read the value of the movement input only when the button is pressed (very much like when the jump button is pressed). And I see that on the test in 15:20 you got the Debug.Log (from the FixedUpdate) printed only when the button is pressed. With the code in the tutorial, the values are printed constantly (with no button pressed the values from the movement vector 2 are printed as 0.0, as it should be, but the problem is that is constantly printing).

    • @guille_sanchez
      @guille_sanchez 2 года назад

      Nevermind I'm stupid, the console was collapse and I didn't notice it xD
      But nonetheless, is there a way to read value only when the button is pressed without having to check it on Update/FixedUpdate?

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      That's the idea behind using the C# events (and a couple others approaches with the new input system). You subscribe to events like "started" and "performed" and the functions only get called when the buttons are pressed. For a lot of use cases you can fully avoid using Update or FixedUpdate to get input.
      Check out any of the videos in the "New Input System" playlist they all use this approach: ruclips.net/p/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk

    • @guille_sanchez
      @guille_sanchez 2 года назад

      @@OneWheelStudio thank you for the response! I'll definitely check the whole playlist out :)
      So far I've been implementing the "started / performed / canceled" callbacks (and I love this event system) but just for buttons. I didn't figure out yet how to use it with a vector 2, since this is a ReadValue.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      Right, for things like mouse and or joystick input it's a bit trickier and I've usually defaulted back to polling the input with an Update. But you want the input every frame. So... yeah I think it's a good solution in that case.

    • @guille_sanchez
      @guille_sanchez 2 года назад

      And just for the record, the implementation for the new input system that I like is the one you used in the video: referencing the input action asset c# class on the awake function and subscribing to the perform/started/etc. callbacks, and using the input.Enable/Disable on the respective OnEnable/OnDisable functions.
      And because I wanted to use the Vector2 values for movement as an event rather than checking its value in an Update or fixedupdate method, I used another implementation that I don't like, which is using the InputAction component and invoking a Unity Event that calls a function that reads the value of the Vector2 (At least it gets the job done, but I would rather be cohesive and have everything done with the implementation shown in this video).

  • @diligencehumility6971
    @diligencehumility6971 3 года назад +1

    Great video. Is it possible to detect which kind of device being used, so you can switch out button prompt? Like for jump having PC: [Space] PS4: [X] Xbox: [A]

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      To be honest, I haven't got that far myself. But Unity has a project that might help (link at the end). The program shows how to display the name or type of device that is controlling a character. Not sure how that's done, but it might get you going in the right direction.
      Link: github.com/UnityTechnologies/InputSystem_Warriors?RUclips&

  • @micaiahstevens8840
    @micaiahstevens8840 3 года назад +1

    (Always forget, just because I am confused, doesn't mean I don't love your style of teaching, lots of people are talking about your clear and concise methodology; and I love it myself)
    That being said a slight woopsie, you said this is super important not to click the wrong button, but you can change it and fix it later. BUT you never say which button you should press, or which is the best setting to use, or you are using.
    ruclips.net/video/YHC-6I_LSos/видео.html
    (Guilty I guess myself, this would be the 'Yes' option)
    I opted to use the New System, with the backwards native, since I was going to only use this project as a test bed for the new system, and your next tutorial.
    I see your active input handler, under the other settings. Is set to both, I see why you would do that, but again never mentioned what you were going to do, seeing HOW important it was to not press the wrong button.
    I think you could have said, if you want to ONLY use the new Input system, should click yes to use the native, and disabled the old input. However in a upgraded project, use both, so you can migrate your old input.
    (I assume if you click no - it will default to both)
    This works in 2019.3 (LTS) as its the same 1.02 package as of today.

  • @diyguild1327
    @diyguild1327 2 года назад

    Thanks so much this was a great intro and really pushed me to dig into this and I honestly prefer this so much to the old input manager. One question though how would have different scripts for different actions? Like say I was to separate Movement and MouseLook actions into their own scripts so I can logically keep the code separated. Would I create a new reference to the input action in each script like you did at 12:50 and mentioned? Also how would I reference the base Action map in each script? Thanks!

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      To answer your first question, yes you would create a new reference to the input action in each script. I made another video on switching action maps and one way to do that is to create a static instance of the input action asset. So that could work too.
      I'm not sure I understand your second question. What is the "base action map?"

    • @diyguild1327
      @diyguild1327 2 года назад

      @@OneWheelStudio Sorry, I worded that bad. By base action map I meant the action map itself. So if I have MouseLook and Movement input actions in the same action map, should there be a new instance of the action map in each of those two scripts? Or should they both reference the same instance of the action map which is defined in its own script?

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      Ah! That makes sense. I think the answer really depends on how and what you want to implement. There are advantages to each script having there own instance - decoupled. But this also makes it hard to switch action maps and couples scritps to some sort of action map manager. So I'm not sure there is a "best way" it just depends on what you are doing.

    • @diyguild1327
      @diyguild1327 2 года назад +1

      Ahh thanks that's helpful I appreciate it. Thank you for making all these videos as well I really appreciate the time and work you put in

  • @mazen7844
    @mazen7844 2 года назад +1

    I'd like to see how to make something like a complex input like mortal kombat special moves for example (down + right + punch)

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      That’s on my to do list! No promises though 😉

  • @choucheneyoussef3281
    @choucheneyoussef3281 2 месяца назад

    if u hold space bar it'll still debug "jump" so its really bad i tried fixing it with tap interaction but its not a perfect solution

  • @KiaAzad
    @KiaAzad 2 года назад

    I've been watching videos on the new input system all morning, trying to get a cube move in four directions, everybody jumps right into the c# classes and skips over explaining how the send messages works. I know it's simply writing functions to handle those events, but I'm looking for someone to hand it over to me in a nice short tutorial instead of forcing me to figure out how to get that vector2 and feed it to my rigidbody. Would you be kind and make a quick one please? Most channels don't cater to the absolute beginners fresh from installing unity.

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      Both my 3rd Person Character video and my Strategy Camera video are a bit more hands on. They might work?
      3rd Person: ruclips.net/video/WIl6ysorTE0/видео.html
      Strategy: ruclips.net/video/3Y7TFN_DsoI/видео.html

    • @KiaAzad
      @KiaAzad 2 года назад +1

      @@OneWheelStudio I've set my heart on learning how the `send messages` works specially with the movement, unfortunate in both of those videos you've jumped right into the deep end and skipped that

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      @@KiaAzad That's fair. I never really looked at a method beyond C# events.

  • @ayanjiuye4535
    @ayanjiuye4535 Год назад

    there are no 2D Vector composite in Input system now

  • @raymondwallington1041
    @raymondwallington1041 2 года назад

    so with 12:53 I'm slightly confused. Did you just not make it static or can input action asset variables not be static at all? Essentially, what do I do if I want an object to fire an event to something it isn't attached to? Like a trampoline that fires a "bounce" event on the player if the collidertag matches?

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      The input action asset can be made static if you want - I did this in another video on changing action maps. This can allow multiple objects to subscribe to events that get invoked when an input action occurs.

  • @eu.gabs.silva.
    @eu.gabs.silva. 3 года назад

    I really would like to see how to swap between Action Maps. It's so complicated but necessary.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      Gotcha you covered: ruclips.net/video/T8fG0D2_V5M/видео.html

  • @chaosmastermind
    @chaosmastermind 2 года назад +1

    Man I got the jump to register and set everything up the best I could, but the console updates don't show any changes in the vector2 even when I'm pressing the WASD keys. It just keeps spamming the values as :
    Movement Values(0.00, 0.00)
    UnityEngine.Debug:Log (object)
    PlayerController:FixedUpdate () (at Assets/Scripts/PlayerController.cs:42)
    I've spent all day trying to fix this, but the menus and such are slightly different than your example, so maybe it's all messed up now??
    I can't get basic WASD input to work. It also detected my USB controller but isn't registering any input on it either even in the debug screen. >.<
    Any advice would help... I might have to just assign separate inputs for each button, cause this vector2 stuff isn't working.

    • @Lelefant_
      @Lelefant_ 2 года назад

      I'm having the same problem. I am using InputSystem 1.1.1 in Unity 2022.1.0a13.

  • @haruka3203
    @haruka3203 3 года назад

    I think I'm gonna watch this like 10 times until I understand xD

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      As many as it takes ;)
      Happy to answer questions here or over on discord too (link in the description).

  • @toastyshrimp1882
    @toastyshrimp1882 2 года назад

    9:37 is there a reason this is done? What is even the difference between leftStick and leftStick/left? It almost seems like they should mean the same thing

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      They aren’t exactly the same thing. The left stick is a vector 2 and will have x and y data. Where as leftstick/left is (probably) just a singular float value and may only trigger when pressing left as opposed to any other direction.

  • @machine0man
    @machine0man Год назад

    12:48 I actually tried to close that notification at the bottom right

  • @gingerTRAVIS
    @gingerTRAVIS Год назад +1

    you know things are poorly documented and overly complex when even the guy doing the tutorials struggles with it, I feel like as a unity beginner I am completely fucked lol, like all I want to do is get the value of a controller input to pass in to a variable, thats it.

  • @branidev
    @branidev 3 года назад

    Wanna see more even more detailed tutorial... still a bit confused cheers!

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      Totally get that. Anything in particular you want to see?

  • @troyd9212
    @troyd9212 3 года назад

    Works perfect for the gamepad, but I am having problems with WASD keyboard controls. When I simultaneously press opposing directions (A+D) or (W+S), it makes the input 0. How can I fix this to where it will always set to either -1 or 1?

  • @shadowscoundrel
    @shadowscoundrel 3 года назад +1

    Is there a way for players to modify the keybinds with this or are players "locked in" with the scheme that players are with in this setup?

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      Rebinding is definitely doable. I actually have a video coming out tomorrow on creating a system to make it happen. The video is long and less scripted but should get most folks started.

    • @shadowscoundrel
      @shadowscoundrel 3 года назад +1

      @@OneWheelStudio Nice!

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      I seemly screwed up the release of the video and need to re-upload and re-release it... In the mean time I'll leave the old one up as unlisted you can find it here: ruclips.net/video/TD0R5x0yL0Y/видео.html

  • @ghostderazgriz
    @ghostderazgriz 2 года назад

    I see in this video you generated a c# class but then use it to assign values to input assets in the Player script. What would be the benefit of Enabling input actions individually like this vs. just enabling the entire Generated class? Is there a clear distinction between both cases?

    • @OneWheelStudio
      @OneWheelStudio  2 года назад

      There's not a huge advantage. At the time of making this video that was all I knew - enabling one action at a time. Since that video, I've generally enabled entire action maps.

    • @ghostderazgriz
      @ghostderazgriz 2 года назад +1

      @@OneWheelStudio Oh ok. Thanks! Good to know. I didn't think there was but I've seen so many vids and they all seem so deliberate as to their chosen method of interacting with the Input Manager. I can't tell if it's through experience or inexperience that those choices are made so thanks for clarifying!

  • @3_14pie
    @3_14pie 3 года назад +2

    Finally some actually useful content and not another "the new input system for people afraid of coding"

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      I might get a lot more views if I went that direction 😛 I hope the video was useful.

    • @3_14pie
      @3_14pie 3 года назад +1

      @@OneWheelStudio helped a lot, im familiar with .NET but not at all with unity, so I made a huge structure just to organize my actions and diferent ways they can be used (click, hold,in cooldown, realeased, and so on) but I had no idea how to recognize the inputs without using that drag and drop. So this video not only helped me to recognize input by code but also helped me to reduce my totally overkill of an input manager

  • @Danyu91
    @Danyu91 2 года назад

    my input actions require context, unlike in your thumbnail where you can simply += or bind the fucntion to the event. i just copied from the different tutorials, but i dont understand why i cant just bind a function without context

    • @OneWheelStudio
      @OneWheelStudio  2 года назад +1

      The event itself sends a CallbackContext object. So every function that subscribes to the event must have the same signature (i.e. the correct input parameters and return type).
      If the functions that you want to subscribe doesn't have that same signature you'll need to make a dummy function to subscribe to the event and then call the other function.
      If that doesn't make sense feel free to jump on the OWS discord, I'm happy to take a look at your code and try to help.

  • @gauravnikalje802
    @gauravnikalje802 3 года назад +1

    Can you show how to Toggle Keys in new Input System? For Ex.: Esc key to toggle between Pause & Resume.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      For something like that I would likely create a bool that tracks the state or similar. Then every time the key press event is performed I’d flip the value -> isPaused = !isPaused