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

Поділитися
Вставка
  • Опубліковано 10 лип 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

КОМЕНТАРІ • 254

  • @HorizoneMeNol
    @HorizoneMeNol Рік тому +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 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!

  • @CosbyKong
    @CosbyKong 2 роки тому +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.

  • @VirtualTurtleGames
    @VirtualTurtleGames 2 роки тому +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 2 роки тому +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 2 роки тому +3

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

  • @steveradtke1308
    @steveradtke1308 Рік тому +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

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

  • @heavymetalhamster7111
    @heavymetalhamster7111 2 роки тому +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.

  • @Miale_of_the_Void
    @Miale_of_the_Void 2 роки тому +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!

  • @goldkat99
    @goldkat99 2 роки тому +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.

  • @_jonathancollins
    @_jonathancollins 3 місяці тому

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

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

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

    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!

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

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

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

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

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

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

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

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

    Perfect amount of thorough, thank you so much

  • @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!

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

    straight to the point. very nice tutorial, thanks!

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

    Excellent explanation and walkthrough. Thank you for posting this.

  • @mikemcghee4750
    @mikemcghee4750 2 роки тому +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  2 роки тому

      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 2 роки тому

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

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

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

  • @Macellomatik
    @Macellomatik 2 роки тому +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. >.>

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

    Great professional way of teaching. Thanks. subscribed!

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

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

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

    You explained this perfectly. Thank you so much!

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

    very nice tutorial! thank you very much for it!

  • @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!

  • @BrianLindahl
    @BrianLindahl 2 роки тому +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.

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

    awesome video! thanks a lot!

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

    you are really good content, keep up good!

  • @RavioliPolioli
    @RavioliPolioli 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 2 роки тому +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!

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

  • @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!

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

  • @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!

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

  • @kykilli3126
    @kykilli3126 3 роки тому +26

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

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

    Thas was a great tutorial!

  • @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!

  • @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 UA-cam. But this is still a good tutorial.

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

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

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

    thank you so much!

  • @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!

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

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

    Loved this.

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

    freaking great tutorial. exactly enough.

  • @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: ua-cam.com/play/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk.html

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

      @@OneWheelStudio +1 subscriber)

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

    I love this channel

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

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

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

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

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

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

    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!

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

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

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

    finally a worthy tutorial

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

  • @jahoopyjaheepu497
    @jahoopyjaheepu497 2 роки тому +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.

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

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

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

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

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

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

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

    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 2 роки тому +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

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

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

  • @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: ua-cam.com/video/TD0R5x0yL0Y/v-deo.html

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

    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  2 роки тому +1

      Done! ;)
      Try this video: ua-cam.com/video/T8fG0D2_V5M/v-deo.html

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

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

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

  • @hainguyenthanh9227
    @hainguyenthanh9227 2 роки тому +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 2 роки тому +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  2 роки тому

      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

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

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

  • @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!

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

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

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

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

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

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

    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  2 роки тому

      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

  • @choucheneyoussef3281
    @choucheneyoussef3281 7 годин тому

    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

  • @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 😉

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

    @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 Рік тому

      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  Рік тому +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: ua-cam.com/play/PL7S-IAgf3dlUPT3iheJaUWu-Johr8bgCk.html

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

      @@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  Рік тому +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 Рік тому

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

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

  • @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?UA-cam&

  • @mohamedwaqqas
    @mohamedwaqqas 2 роки тому +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  2 роки тому +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 2 роки тому +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  2 роки тому +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 😛

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

    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  2 роки тому

      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.

  • @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!

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

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

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

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

    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  3 роки тому

      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?

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

    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  2 роки тому

      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.

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

    @onewheelStudio hey im trying to use the new input system for my project and all is going well except one aspect. my swipe detection does not work if im already touching the screen. How can i use the input system to recognize my swiping finger even if its the 2nd or 3rd touch on the screen at that time? Thanks

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

      Sorry. Wish I could help. I've got virtually zero experience with touch or mobile.

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

      @@OneWheelStudio I understand, thank you

  • @shadowscoundrel
    @shadowscoundrel 2 роки тому +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  2 роки тому +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 2 роки тому +1

      @@OneWheelStudio Nice!

    • @OneWheelStudio
      @OneWheelStudio  2 роки тому +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: ua-cam.com/video/TD0R5x0yL0Y/v-deo.html

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

    there are no 2D Vector composite in Input system now

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

    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  3 роки тому

      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 3 роки тому

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

  • @eu.gabs.silva.
    @eu.gabs.silva. 2 роки тому

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

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

      Gotcha you covered: ua-cam.com/video/T8fG0D2_V5M/v-deo.html

  • @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?

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

    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  3 роки тому +1

      I think this got fixed? ;)

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

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

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

    Can we adapt this to Corgi Engine? Does it take a long time to do?

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

      I would assume the corgi engine can either be adapted or already has - the developer is pretty active - but I can't say for sure.

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

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

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

    I can't find the manual

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

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

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

    I can get text to show up, but I am so confused on how to get this input to move a player.

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

      In the next week or two I was thinking to put together an informal video - maybe even start as a stream - of building the 3rd person controller I show in the video from scratch. Maybe that would help?

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