3RD PERSON CONTROLLER in Unity - Input System

Поделиться
HTML-код
  • Опубликовано: 27 сен 2024
  • In this video (Episode 1) will implement Unity's new input system, and create our inputs that will handle our player's movement!
    ► PLAYER MODEL & ANIMATIONS
    drive.google.c...
    ► JOIN OUR DISCORD
    / discord
    ► SUPPORT ME ON PATREON!
    / sebastiangraves
    ► ASSET STORE PAGE (Animations & Models)
    assetstore.uni...
    ► FOLLOW ME IN INSTAGRAM!
    / tragicallycanadian
    ► EPISODE 2
    • 3RD PERSON CONTROLLER ...

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

  • @bigsimpin5722
    @bigsimpin5722 2 года назад +235

    For people doing this in 2022+ at around the 2 minute mark when he is going over bindings, the "2dVector" type has been renamed to "add up/down/left/right composite"

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

      So helpful thank you very much

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

      hmm seems they renamed it again?

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

      ahh got it had to set actiontype to value and control type to vector2 first

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

      don't use values use passthrough else your player never stops moving

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

      Thanks

  • @TheCede555
    @TheCede555 2 года назад +12

    I completed your Darksouls Locomotion chapters and had a few issues as i'm new to Unity, I then followed your 3rd Person survival Horror Locomotion and managed to successfully follow that, now I'm following these series so I can really grasp these basic principles before I move on. It has been extremely helpful to learn a lot of the concepts that i've been attempting, such as referencing other c# scripts and having them work together almost like modules, having root motion or not and organising my scripts effectively with almost 'on the job' learning on how to use the language. You've really helped me learn a lot the past week! Thank you for creating such informative and helpful videos.

    • @Hiro-zb1vu
      @Hiro-zb1vu Год назад

      no joke me too lol

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

      Hey i have a question. Can I implement weapon scripts and stuff from darksouls videos into this new 3rd person controller?

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

    If I could like this video more than once for the "RUclips algorithm gods" I totally would. These are exactly the kind of straight up, no-bullsh*t "How to do this or that" tutorials I was looking for. Me and my already-too-high blood pressure are very grateful.

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

    I have watch all videos on unity and tried to learn unity and make a controller . Your the only one that made sense. I was about to give up on making games. Thanks for giving me motivation to continue.

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

      many tutorial is good to understand programming, but old version.

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

      You can even buy courses in udemy. Dont give up

  • @saadbutt2186
    @saadbutt2186 3 года назад +9

    This is One Of the the best channel i ever have found. The way you teach is so simple keep it up it helps alot of people to understand game development.

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

    Best tutorial for the new input system out there, hands down! I spent 2 hours wasting my time on other vids before this.

  • @babalaklowns
    @babalaklowns 3 года назад +6

    I feel like the line playerControls.PlayerMovement.Movement.performed += i => movementInput = i.ReadValue(); wasn't explained very well. Also I feel like i is not a very good name since i is of type InputAction.CallbackContext. A better name would be context or rather it would be more clear if you actually wrote out the callback function instead of using a lambda. Correct me if I'm wrong, but I had to watch some other videos to really understand what was going on in that line of code. I would recommend you slow down a bit and explain some of the nuances.

    • @kajtek8208
      @kajtek8208 9 месяцев назад

      Exactly my boy, i had trouble to understand this code

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

    How did it take me this long to find your content! Very nice tutorial and layout of the new input system this video alone could get anyone started, I look forward to the rest of the videos.

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

    I came here after trying your Dark Souls episode 1 because I could copy the script but the logic was very difficult to follow. This video has been a huge help for learning the Input system, thank you.

  • @delcraft7709
    @delcraft7709 9 месяцев назад +1

    Wish I found these videos of yours earlier, I would save myself a lot of time. Thank you!

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

    something isn't working because when I put PlayerControls into my script it comes up saying it doesn't exist
    (I have generated the script btw)

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

    really good tutorial as always man, one more like and comment for the algorythmes god because you deserve to be more know over the world. I'm gonna use this serie to make a template for most of my 3rd person projects!

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

    When I get to the end and I test out the inputs, pressing WASD doesn't change the values in the input manager. I've checked and redone the tutorial a couple times and my code seems to be perfect, so what's the issue?

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

      It happened to me as well. If you name your script Input Manager, with a space between the 't' and the 'M' that causes a problem because when the class is made, there is no space in 'InputManager'. In other words, there is no reference to 'Input Manager', but there is one to 'InputManager'.
      Delete the script, create it without the space, and it should work.

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

    My God! This is my oversight, I didn't pay attention to building the manager initially, sir, you are beautiful!

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

    So far so good, best explanation of this new user input system I've heard so far!

  • @wabsastudios
    @wabsastudios Год назад +3

    hay i am new to unity at 3:37 when you set that player controls reference(that variable) it not working it does not shows as a variable there is nothing can you help

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

    The OnEnable stuff is not apearing for me

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

    So, I followed every step in the video, but the inputManager isnt changing any values

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

    Very Detailed

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

    Hey would anyone be able to explain "playerControls.PlayerMovement.Movement.performed += i => movementInput = i.ReadValue();" in more detail? I'm still very new to game dev and I want to know more about what the different pieces do so I can use it in the future, or what to look up in the documentation to get more information about it.

    • @Rahulsingh-theraha
      @Rahulsingh-theraha 2 года назад

      += is just used for subscribing the event delegate, u will understand better once you watch some event n delegates, they are really easy

    • @peace_9001
      @peace_9001 9 месяцев назад

      bro i have error like this Object reference not set to an instance of an object
      @@Rahulsingh-theraha

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

    You are explaining very well, waiting for your videos!

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

    I really don't see how it's better than the old input system... looks so complicated for a simple job xD

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

      It's universal. It's agnostic input code that can be applied cross platform regardless of the major differences in input systems with very little effort once the initial setup is complete.

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

    Hi sebastian, would you happen to know the reason why my c# script cannot detect the PlayerControls at all? non of the lines turn green as it happens to you despite following this video step by step

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

      im having issues with the Null and playerControls section, did you figure it out?

  • @Zero-Skillz
    @Zero-Skillz 3 года назад

    This is really good. Either you are too quick for me or I'm just not ready for this. Back to "Hello world" I go.

  • @smuel2k
    @smuel2k Год назад +3

    Assets\inputManager.cs(17,43): error CS1061: 'PlayerControls.PlayerMovementActions' does not contain a definition for 'Movement' and no accessible extension method 'Movement' accepting a first argument of type 'PlayerControls.PlayerMovementActions' could be found (are you missing a using directive or an assembly reference?)
    what does this mean and how can i fix it?

    • @kingofspades9720
      @kingofspades9720 6 месяцев назад

      I know this is a year late, and I really hope you have found a solution by now, but in case you have not, this is your problem.
      You have
      'PlayerControls.PlayerMovementActions.Movement'
      First, you chose to say PlayerMovementActions instead of just PlayerMovement, you probably did it because thats what the autofill said to put. but the reason why autofill said to add 'Actions" was because you capitalized P in PlayerControls, which means that unity is trying to read from the class instead of from your instance of the class.
      So the code should be
      'playerControls.PlayerMovement.Movement'

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

    i gave myself a pat on the back without you telling me to, i hope that's okay with you!

  • @xdcretin-_-7363
    @xdcretin-_-7363 3 года назад +3

    Finally someone who makes understandable tutorials

  • @m.bukhori2304
    @m.bukhori2304 2 года назад +3

    Assets\inputmanager.cs(7,5): error CS0246: The type or namespace name 'PlayerControls' could not be found (are you missing a using directive or an assembly reference?
    help please

    • @kingofspades9720
      @kingofspades9720 6 месяцев назад

      Are you sure you pressed "Generate C# script" in the input map?

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

    Why does the tutorial video portion stop at the 6:50 mark? It's just audio after that and your avatar?

    • @kingofspades9720
      @kingofspades9720 6 месяцев назад

      Because he's not explaining how to do anything anymore at that point, he is just doing commentary on what we did and what the next one will cover

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

    For me this happens The type or namespace name 'PlayerControls' could not be found (are you missing a using directive or an assembly reference?)

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

    It's great how the new player input system does the same thing Unity has always been doing, but now it is 10x more complex.

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

    the 2d vector composite is now named: Add/up/down/left/right composite

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

    this series is helping me so much, thank you so much for the high quality content for free!

  • @Denny0707
    @Denny0707 11 месяцев назад

    You're really helping me! Thanks!

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

    Nah man I found a new Bracket that can teach! Thank you Sebastian

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

    Came from dark souls series. I am new to unity so this is really useful! Thank you.

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

    I dont get the OnEnable thing and how did you get Private Void OnEnable?

  • @-Lola.
    @-Lola. 2 года назад

    Bro, will you marry me?? This series is so helpful. I like how you actually explain the code you’re writing, rather just basically telling everyone to copy what you’ve got and nothing else

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

    One of the best tutorial i've ever seen. You get new subscribe ! thanks

  • @992darus
    @992darus 3 года назад

    Thanks for making this kind of video, now I understand how it works :]

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

    Thank you very much for the excellent video, I will follow this playlist

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

    my visual studio never give any of those recommended phrases like he gets and activates I get different crap showing up that isn't anything like what im typing.

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

      you have to link it to unity i forgot how but you can surch up a totorial

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

    Excellent tutorial format!

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

    I accidentally made myself jump to the moon

  • @24framedavinci13
    @24framedavinci13 11 месяцев назад +1

    For those who have an error "the type or namespace player controls couldnot be found" click on the player controller input actions and generate c# script

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

    Goated. i was looking at antoher input tutorial and the guy didnt' even mention how to add the up left right down system.

  • @Cardenalcreed-uf9eo
    @Cardenalcreed-uf9eo 2 месяца назад

    at 4:31 my code said that PlayerControls had no definition for PlayerMovement and I don't know what to do to fix it

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

    Whenever I try running the game after adding the input manager there's never any changes to the movement input values. All of my code matches yours and the names match up. I'm not getting any error messages for it the values just won't change. What should I do?

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

      I'm getting the same thing

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

      i know this is old but im struggling- did you find a solution?

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

      I also am having the same problem... I don't know what to do.

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

    Wonderful tutorial, thank you so much

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

    I understood everything except what "i" means? This tutorial is very helpful

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

      Lol, btw lets collab developing games alone feels kinda alone...

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

      @@ShatabdaRoy115 I am ready

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

      From my understanding I is just a normal variable name. It can be anything

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

      @@ShatabdaRoy115 are u still up for collab?))

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

      @@marcus_74 yo lets do it! Whats ur discord?

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

    If you are having problems with PLAYER MOVEMENT or PLAYER CONTROL script isn't runnig, just turn back to begin, and start over. Make sure that you put the exacly same words( include uppercase on first letter etc). I made it and work! if you miss a letter or uppercase, nothing will work!
    Sorry for my bad English, i'm from Brazil!

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

    What is the difference between the 3 action types: value, button & passthrough? And why did you choose passthrough instead of value or button? Great video, btw

  • @kidsdodrugsanddie
    @kidsdodrugsanddie Год назад +4

    If anyone is having difficulty with your movement values not resetting to 0, you need to double click the playerController Input action file, and set your movement actions Action type to be Pass Through instead of value.
    Hope I helped someone save some hours on troubleshooting like I had to.

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

      Probably saved me from that, thanks

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

      TY I WAS GOING CRAZY XD

    • @johnbranham2969
      @johnbranham2969 10 месяцев назад

      You are an angel among us!! Much thanks!

  • @kenchin2391
    @kenchin2391 11 дней назад

    I just get confused with debuging movement input because my controller was connected 😭

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

    thanks a lot for this, im a newbie so i really appreciate this video

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

    Thank you , this video is a really good

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

    Problem when i press play, Assets\InputManager.cs(11,12): error CS0246: The type or namespace name 'PlayerControls' could not be found (are you missing a using directive or an assembly reference?)

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

      having the same problem here

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

      same problem, did you find a solution?

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

      @@wilcas5349 no sorry

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

      I found the issue, in my case, forgot to do the step at 0:57

  • @guxtavp
    @guxtavp 3 месяца назад

    can someone point to me where i can learn more about whats happening at line 17 4:49? copied what's written there, but have no clue what all that really means

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

    thanks mate

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

    Keep it up!

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

    Not getting input actions on right click

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

    I Love This Man!!

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

    Why the blank screen with your picture on it starting at 6:41? I can hear you talking but there is no video.
    Also, I am getting the opposite numbers you are getting with the X Y inputs.

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

    Anybody who have trouble with not popping up "properties", go and delete "vjoy" in your computer. It collides with new Input System package.

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

    Amazing video thanks

  • @fabse404
    @fabse404 3 года назад +6

    just starting Unity, and i think this will make my life way mor enjoyable, looking forward for this series :D
    i have one question:
    why do you prefer the public var over the SerialzedField Tag?
    greetings

    • @Rahulsingh-theraha
      @Rahulsingh-theraha 2 года назад

      Good coding practice i.e never expose your variable to other script unless it is needed

  • @IndieGamedevv
    @IndieGamedevv 3 месяца назад

    Bro why my (PlayerMovement) error and doesNot reference from PlayerControls

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

    Great tutorial!

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

    Nice tutorial, checking out more of your content!

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

    Thank youuuuuuuuuuuuuuu😍Amazing contents!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!😍

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

    Hey man! Everything is going awesome but a small problem. The InputManager isn't appearing in the add component list. Can anyone help?

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

      ??? I am a beginner I don’t know anything about unity

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

      having the same issues so i would like the help too

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

      clear your search on the component list, if that doesn't work just physically drag your script from your project>assets window and drop it on your characters inspector

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

    Happy new year sensei

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

    Please teach us how to make a procedural climbing system

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

    thank you soo muchh

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

    For some reason, the camera still won't move and I followed the scripts and everything to the T. I think it might be the prefab character model I used, so I'm gonna try again with a different model to see if it helps...

  • @peace_9001
    @peace_9001 9 месяцев назад

    bro my code showing error like this "Object reference not set to an instance of an object"what i do plss healp

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

    Hey. In add component for the polyman there is no Input Manager showing up, even tho i programmed it and it is in the assets. can you help?

  • @Salvadorioo
    @Salvadorioo 6 месяцев назад +1

    Какой же я тупой. Это пиздец. Как я собираюсь писать диплом, если даже этого понять не могу. как же все бесит

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

    I still dont understand why are you assigning movementInput through value in OnEnable. Could anyone please fill me in?

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

    4:51 Question : what is the expression "i => MovementInput" called. I dont know what that is and what it do.

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

    when I double clicked on the thing it brought me to visual studios

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

    Best Tutorial...GoOn

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

    Could I add Left Stick as a binding rather than adding the 4 directional Left Stick input?

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

    Hi, i write you codigo, but the character don´t move...

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

    Great video but Im having a problem... when I go back to unity after inputting the script, it tells me this: "Assets/InputManager.cs(7,31): error CS1519: Invalid Token ';' in class, struct, or interface member declaration" If you could please help me that would mean anything, also when I try to click play it says "All compiler errors have to be fixed before you can enter play mode!"

  • @dionysoft
    @dionysoft 8 месяцев назад

    why used analog mode ?

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

    Thought I posted this yesterday, but it seems to be gone.. so Right with you up until 6:35 but I get a null reference, when pressing the keys, and no vector update on the player, its like I need to get the reference with getComponent in the Awake function, but YOu never did that so I assume not..

  • @NA-pr8lh
    @NA-pr8lh 2 года назад

    What visual studio code extensions did you use for this

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

    hi can u make joystick movement and wasd movement

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

    wow instant subscribe

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

    when ever i try to open a script it brings me to unity hub

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

    Hi.
    Can you add combat bottons for a gun and sword?
    and show how to use it with animations?
    Can you add the script for download please?
    and to all of the other videos please.
    it's not working right for me.

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

    Bruh. thank you.

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

    Thank you for the detailed explanations on the topic of the controller, but I can not understand the reason for the errors in the code? I exactly repeat all your actions, however, the errors do not disappear, I use Unity 2021 lte. I would be grateful if you explain what is wrong. Severity Code Description Project File Line Suppression State
    Error CS0119 'PlayerControl' is a type, which is not valid in the given context Assembly-CSharp, Assembly-CSharp.Player D:\UNITY_GAME\TPC_PART-2\Assets\InputManager.cs 16 Active
    Error CS0120 An object reference is required for the non-static field, method, or property 'PlayerControl.Enable()' Assembly-CSharp, Assembly-CSharp.Player D:\UNITY_GAME\TPC_PART-2\Assets\InputManager.cs 23 Active
    Error CS0120 An object reference is required for the non-static field, method, or property 'PlayerControl.PlayerMovement' Assembly-CSharp, Assembly-CSharp.Player D:\UNITY_GAME\TPC_PART-2\Assets\InputManager.cs 20 Active
    Error CS0103 The name 'movementInput' does not exist in the current context Assembly-CSharp, Assembly-CSharp.Player D:\UNITY_GAME\TPC_PART-2\Assets\InputManager.cs 20 Active
    Error CS0103 The name 'playerControlInputManager' does not exist in the current context Assembly-CSharp, Assembly-CSharp.Player D:\UNITY_GAME\TPC_PART-2\Assets\InputManager.cs 18 Active

  • @traynorth83
    @traynorth83 8 месяцев назад

    Do you have the source codes for this series?

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

    Problem with the read Value

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

    When i try adding the input manager script to the low polygon character it says, "Can't add script component 'Input Manager' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match" plz help if you can.

  • @LJ-pn3em
    @LJ-pn3em 2 года назад

    can get the 2d vector composite

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

    Would this tutorial work with 2019.4.3f1?

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

    What... what happened at 6:55?