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

Sdílet
Vložit
  • čas přidán 16. 07. 2024
  • Unity's new input system is event-based plus it handles keyboard mouse and gamepads easily and quickly. The video looks at action maps, actions, bindings, action types, interactions, and processors. Which can be used to dial in the controls for a Unity project. The system can broadcast messages, use Unity events, or best of all use C# events which can clean up your code - specifically your update functions.
    Version 1.0.2 of the input system was used along with Unity 2020.3

    Assets Used (affiliate links)
    ******************************
    Low Poly Farm: assetstore.unity.com/packages...
    Male Peasant Modular Pack: assetstore.unity.com/packages...
    Want to support the Channel?
    *******************************
    Buy me a coffee: www.buymeacoffee.com/onewheel...
    Shop the Unity Asset Store (affiliate): assetstore.unity.com/top-asse...
    Become A Channel Member: / @onewheelstudio
    Or a Patron: / onewheelstudio
    Grab a T-Shirt: onewheelstudio.com/merch/
    My video and streaming kit: kit.co/onewheelstudio/tutoria...
    Buy a Game Design Book: kit.co/onewheelstudio/game-de...
    Other Links
    ************
    Discord: discord.onewheelstudio.com
    Twitter: / onewheelstudio
    Devlog: onewheelstudio.com/
    Twitch: / onewheelstudio
    Video Gear List (Amazon Affiliate)
    ***********************************
    Sony A6100 Camera: amzn.to/32logXz
    Sigma 16mm 1.4 Camera Lens: amzn.to/3KA4Wr4
    GoXLR (audio interface): amzn.to/35dmr03
    Shure SM7B Mic: amzn.to/3fNbV1E
    Blue Mic Arm: amzn.to/3tHgwdQ
    Neewer Light: amzn.to/3rD8eRv
    Light Softbox: amzn.to/3GUaHgQ
    Neewer RGB Light: amzn.to/3rCTQJ9
    Timestamps
    *************
    0:00 Warning!!!
    0:09 Intro
    0:40 Why use the new system?
    2:04 Adding the New Input System
    2:50 Creating the Input Asset
    3:23 Action Maps
    4:06 Actions
    4:27 Action Types
    6:35 Interactions
    7:10 Processors
    7:30 Creating Bindings
    10:19 Saving Input Asset
    10:39 Default Player Input Component
    11:14 Generate C# Class & Events
    11:50 Player Controller Class
    15:10 Testing the Controller
    16:08 Want to see more???
    16:30 THE END
    #unityinputsystem #GameDevelopment #Unity3D #indiedeveloper

Komentáře • 254

  • @HorizoneMeNol
    @HorizoneMeNol Před rokem +45

    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 Před 2 lety +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!

  • @CosbyKong
    @CosbyKong Před 3 lety +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.

  • @_jonathancollins
    @_jonathancollins Před 3 měsíci

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

  • @steveradtke1308
    @steveradtke1308 Před 2 lety +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  Před 2 lety +2

      Glad it helped! Do check out the whole playlist with a bunch of applications of the new input system ;)
      czcams.com/play/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk.html

  • @VirtualTurtleGames
    @VirtualTurtleGames Před 2 lety +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.

  • @corygreaves1227
    @corygreaves1227 Před 2 lety +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!

  • @neorevolutionnar
    @neorevolutionnar Před 2 lety +3

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

  • @heavymetalhamster7111
    @heavymetalhamster7111 Před 2 lety +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.

  • @goldkat99
    @goldkat99 Před 2 lety +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.

  • @Miale_of_the_Void
    @Miale_of_the_Void Před 2 lety +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!

  • @jamesstephenson4544
    @jamesstephenson4544 Před 2 lety

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

  • @lilyflowerangel
    @lilyflowerangel Před 2 lety +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  Před 2 lety

      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!

  • @mayankbhaisora2699
    @mayankbhaisora2699 Před 2 lety

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

  • @Macellomatik
    @Macellomatik Před 2 lety +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 Před 2 lety +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. >.>

  • @TheGabmeisterX
    @TheGabmeisterX Před 3 lety +3

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

  • @mikemcghee4750
    @mikemcghee4750 Před 3 lety +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  Před 3 lety

      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 Před 2 lety

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

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety

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

  • @exhilex
    @exhilex Před 3 měsíci

    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!

  • @devong1838
    @devong1838 Před 3 lety +1

    Perfect amount of thorough, thank you so much

  • @jakubstacho9199
    @jakubstacho9199 Před 2 lety +1

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

  • @dannybrez
    @dannybrez Před 2 lety

    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  Před 2 lety

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

  • @RavioliPolioli
    @RavioliPolioli Před 3 lety +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 Před 2 lety +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 Před 2 lety +1

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

    • @travisstanley7016
      @travisstanley7016 Před 2 lety

      @@MQNGameDev This. Thanks!

  • @HTMLlama
    @HTMLlama Před rokem

    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.

  • @ZeroChronicles01
    @ZeroChronicles01 Před 3 lety +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!

  • @ernestj8000
    @ernestj8000 Před 2 lety

    Excellent explanation and walkthrough. Thank you for posting this.

  • @JaysOnTheMoon
    @JaysOnTheMoon Před 3 lety +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  Před 3 lety +1

      Anything in particular you’re interested in seeing?

    • @JaysOnTheMoon
      @JaysOnTheMoon Před 3 lety +2

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

  • @cathalmccosker
    @cathalmccosker Před rokem +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!

  • @PcKaffe
    @PcKaffe Před 2 lety +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!

  • @diliupg
    @diliupg Před 2 lety +1

    Great professional way of teaching. Thanks. subscribed!

  • @dolguldur1833
    @dolguldur1833 Před 2 měsíci

    straight to the point. very nice tutorial, thanks!

  • @citan554
    @citan554 Před 2 lety

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

  • @dogsnout
    @dogsnout Před 2 lety

    You explained this perfectly. Thank you so much!

  • @BrianLindahl
    @BrianLindahl Před 2 lety +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 Před 2 lety

    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.

  • @halivudestevez2
    @halivudestevez2 Před 2 lety +2

    very nice tutorial! thank you very much for it!

  • @littlearvin1641
    @littlearvin1641 Před 2 lety +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  Před 2 lety +4

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

  • @Any1SL
    @Any1SL Před 3 lety +1

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

  • @hernandonj
    @hernandonj Před 2 lety +1

    awesome video! thanks a lot!

  • @martincalander
    @martincalander Před 3 lety +2

    you are really good content, keep up good!

  • @bigmancozmo
    @bigmancozmo Před 2 lety +1

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

  • @mg1632
    @mg1632 Před 2 lety +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 Před 2 lety +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

  • @kykilli3126
    @kykilli3126 Před 3 lety +26

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

  • @amrosk
    @amrosk Před 3 lety

    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  Před 3 lety +1

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

  • @panda_unleashed1222
    @panda_unleashed1222 Před 2 lety

    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.

  • @mecsimoto7010
    @mecsimoto7010 Před 2 lety

    Thas was a great tutorial!

  • @crookeddream
    @crookeddream Před 2 lety

    freaking great tutorial. exactly enough.

  • @prenomnom6300
    @prenomnom6300 Před 2 lety +1

    thank you so much!

  • @jaybenton7716
    @jaybenton7716 Před 3 lety +1

    Loved this.

  • @canuniverse3367
    @canuniverse3367 Před 2 lety +1

    finally a worthy tutorial

  • @m_maksym
    @m_maksym Před 2 lety +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  Před 2 lety +1

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

    • @m_maksym
      @m_maksym Před 2 lety

      @@OneWheelStudio +1 subscriber)

  • @chaosmastermind
    @chaosmastermind Před 2 lety +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 Před rokem +2

      Life saver! Ty

    • @Robocat754
      @Robocat754 Před rokem

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

  • @pedropc5824
    @pedropc5824 Před rokem

    I love this channel

  • @betadv
    @betadv Před 2 lety

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

  • @li0nleo918
    @li0nleo918 Před 2 lety +1

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

  • @rungy8214
    @rungy8214 Před rokem

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

  • @SharkySSharkington
    @SharkySSharkington Před 2 lety +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 Před 2 lety +3

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

    • @XxLocodragonxX
      @XxLocodragonxX Před 2 lety +2

      Thank you so much

  • @jahoopyjaheepu497
    @jahoopyjaheepu497 Před 2 lety +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 Před 2 lety +2

      Same here

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety +1

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

  • @karolr8469
    @karolr8469 Před 3 lety +1

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

  • @moltebergk
    @moltebergk Před 2 lety

    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.

  • @halivudestevez2
    @halivudestevez2 Před 2 lety +1

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

  • @isjesse1
    @isjesse1 Před 2 lety +1

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

  • @TheLegendsOfTynedale
    @TheLegendsOfTynedale Před 2 lety +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  Před 2 lety

      I've got a video on rebinding keys. Should get you headed in the right direction. Link: czcams.com/video/TD0R5x0yL0Y/video.html

  • @Frenotx
    @Frenotx Před 2 lety

    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  Před 2 lety +1

      Done! ;)
      Try this video: czcams.com/video/T8fG0D2_V5M/video.html

    • @Frenotx
      @Frenotx Před 2 lety +1

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

  • @codycanipe4415
    @codycanipe4415 Před 2 měsíci

    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!

  • @OfficialMageHD
    @OfficialMageHD Před 3 lety +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.

  • @julianmjk5120
    @julianmjk5120 Před 2 lety

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

  • @hainguyenthanh9227
    @hainguyenthanh9227 Před 2 lety +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.

  • @vandende
    @vandende Před 2 lety +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.

  • @mazen7844
    @mazen7844 Před 2 lety +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  Před 2 lety +1

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

  • @Frenotx
    @Frenotx Před 2 lety +1

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

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety +1

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

  • @cloudwolf3972
    @cloudwolf3972 Před 2 lety +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  Před 2 lety

      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

  • @D-Dev
    @D-Dev Před 3 lety +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  Před 3 lety

      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 Před 3 lety +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  Před 3 lety +1

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

  • @diyguild1327
    @diyguild1327 Před 2 lety

    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  Před 2 lety +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 Před 2 lety

      @@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  Před 2 lety +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 Před 2 lety +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

  • @blaizerhodes
    @blaizerhodes Před rokem

    If you use compiled input assets can you then rebind keys in game?

  • @troyd9212
    @troyd9212 Před 2 lety

    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?

  • @PontonFSD
    @PontonFSD Před 2 lety +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 Před 2 lety +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 Před 2 lety +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 Před 2 lety

      @@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 Před 2 lety

      @@JohnnyThousand605 block fighter is not working on mac bro

  • @mohamedwaqqas
    @mohamedwaqqas Před 3 lety +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  Před 3 lety +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 Před 3 lety +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  Před 3 lety +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 😛

  • @raymondwallington1041
    @raymondwallington1041 Před 2 lety

    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  Před 2 lety

      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.

  • @jaxowaraxa
    @jaxowaraxa Před 3 lety +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 Před 3 lety

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

  • @diligencehumility6971
    @diligencehumility6971 Před 3 lety +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  Před 3 lety +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?CZcams&

  • @guille_sanchez
    @guille_sanchez Před 2 lety

    @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 Před 2 lety

      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  Před 2 lety +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: czcams.com/play/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk.html

    • @guille_sanchez
      @guille_sanchez Před 2 lety

      @@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  Před 2 lety +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 Před 2 lety

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

  • @BlackJar72
    @BlackJar72 Před 2 lety

    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  Před 2 lety +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.

  • @choucheneyoussef3281
    @choucheneyoussef3281 Před 6 dny

    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

  • @ayanjiuye4535
    @ayanjiuye4535 Před rokem

    there are no 2D Vector composite in Input system now

  • @eu.gabs.silva.
    @eu.gabs.silva. Před 2 lety

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

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety

      Gotcha you covered: czcams.com/video/T8fG0D2_V5M/video.html

  • @cecilloki
    @cecilloki Před 2 lety

    Hey @One Wheel Studio I dont know how to get when the mouse button down for example, could you help me, because I need set an animation for an action that need hold the button down

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety

      You could create a custom action and binding. Or you can also poll the mouse. The documentation for the mouse is here: docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Mouse.html

  • @branidev
    @branidev Před 3 lety

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

    • @OneWheelStudio
      @OneWheelStudio  Před 3 lety

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

  • @armoredgreatbear
    @armoredgreatbear Před 3 lety

    Hi , great video!! Im having trouble because i want to use a global input on player like the documentation refers, but i dont know how to use the InputAction.CallbackContext in details can u help?

    • @OneWheelStudio
      @OneWheelStudio  Před 3 lety

      Can you give me a bit more info on what you are trying to do? Can you share a link to the part of the documentation you're referring to?

  • @machine0man
    @machine0man Před 9 měsíci

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

  • @vidadr
    @vidadr Před 2 lety

    What should I do if there are two input event system managers? Atavism uses Unity's default one, while Game Creator uses it's own event system manager. Only one can be active, so how do I merge these so they both work?

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety

      I think that would really depend on what they do. It might be a question to direct to the developers of those tools? Sorry, wish I could be more helpful.

  • @chaosmastermind
    @chaosmastermind Před 2 lety +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_ Před 2 lety

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

  • @OneWheelStudio
    @OneWheelStudio  Před 3 lety +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.

  • @KBforJesusChrist
    @KBforJesusChrist Před rokem

    I can't find the manual

  • @NyoiboNihKids
    @NyoiboNihKids Před 2 lety

    idk why but the properties not showing on mee anyone can help?

  • @ghostderazgriz
    @ghostderazgriz Před 2 lety

    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  Před 2 lety

      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 Před 2 lety +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!

  • @shadowscoundrel
    @shadowscoundrel Před 2 lety +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  Před 2 lety +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 Před 2 lety +1

      @@OneWheelStudio Nice!

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety +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: czcams.com/video/TD0R5x0yL0Y/video.html

  • @StormyDoesVR
    @StormyDoesVR Před 2 lety

    Im trying to use the input system to hear if an XR controller's button is pressed and then make my player controller jump via code, but I can't figure out how to execute a void when a button is pressed. I was close using your tutorial but on the farmerInputActions.Player.Movement part, it can't find the Player.

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety

      I’m out of town and basically off the grid atm. Happy to help next weekend when I get back. Feel free to jump on discord and ping me.

  • @OfficialMageHD
    @OfficialMageHD Před 3 lety

    Have you checked out the 2021.2 beta? Seems to be something weird going on with button on hold actions there vs 2021.1

    • @OneWheelStudio
      @OneWheelStudio  Před 3 lety

      No I haven’t. I generally stay away from new versions to be honest. 😛 I wonder if it’s a new version of the input system?

    • @OfficialMageHD
      @OfficialMageHD Před 3 lety

      ​@@OneWheelStudio I usually check them out if something specific catches my eye, and so far haven't been doing anything that I'm too worried about stability currently. Been working with the UI Builder stuff which seems a bit better in the beta.
      They're on 1.1.0-pre.5 and after messing around with it more it seems that the main issue for me (could be more alongside it I'm not noticing lol), is that button on hold actions take the default hold time in the settings, not just for starting the action, but how long it runs for as well. Its default is 0.4 and I tried it with 8 seconds and it seems to follow that more or less.

  • @PeterSkywalkerYT
    @PeterSkywalkerYT Před 3 lety

    I loved the video and it helped me understand all the concepts I had heard in other tutorials from other programmers, but I still have one bug that I dont understand why it's happening. I did the exact same steps as you, but when I test the controller and I press the Space key to jump (or any other key), it performs the method DoJump twice. Does this happen to anyone else? Thank you in advance.

    • @OneWheelStudio
      @OneWheelStudio  Před 3 lety +1

      I think this got fixed? ;)

    • @PeterSkywalkerYT
      @PeterSkywalkerYT Před 3 lety +1

      @@OneWheelStudio yes, after that I joined your discord and we talked about this! :D

  • @everlastingmedia
    @everlastingmedia Před 2 lety +1

    Key Combinations
    Timed Actions etc

    • @OneWheelStudio
      @OneWheelStudio  Před 2 lety

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

    • @everlastingmedia
      @everlastingmedia Před 2 lety +1

      @@OneWheelStudio Nice! Thanks for the effort