3D Platformer in Unity - Player Controller (Part 1)

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 พ.ย. 2024
  • เกม

ความคิดเห็น • 79

  • @git-amend
    @git-amend  ปีที่แล้ว +21

    Hi everyone! There's a small bonus in the first few minutes! Click the LIKE button if you find it useful!

  • @s.w.e.d.3057
    @s.w.e.d.3057 8 หลายเดือนก่อน +4

    hidden gem channel. been doing Unity for 6 years now and the first 2min 30seconds are enough to show this guy aint messing around

    • @git-amend
      @git-amend  8 หลายเดือนก่อน

      Hey! Thanks for the kind words!

  • @ewwitsantonio
    @ewwitsantonio ปีที่แล้ว +9

    Can't believe I've never thought to automate the creation of the same folder structure I create EVERY time. HELLO! Haha. Thank you. I think I'll be learning a lot from you!

    • @git-amend
      @git-amend  ปีที่แล้ว +1

      Haha, sometimes the simplest solutions are the ones we overlook! Nice to have you here!

  • @AaronAsherRandall
    @AaronAsherRandall ปีที่แล้ว +6

    Just, wow! My jaw dropped when you created the Setup tool in the beginning! Please continue this series, it's amazing!

    • @git-amend
      @git-amend  ปีที่แล้ว +3

      Haha! The setup tool gets more powerful in future episodes! Glad you like it.

    • @orpheuscreativeco9236
      @orpheuscreativeco9236 8 หลายเดือนก่อน

      ​@@git-amendSeriously dope 👍 Thanks for sharing your experience and knowledge with us ✌️✨

    • @git-amend
      @git-amend  8 หลายเดือนก่อน

      @@orpheuscreativeco9236 Thanks!

  • @foliyen
    @foliyen 5 วันที่ผ่านมา

    this is pure gold!!! thank you!

    • @git-amend
      @git-amend  5 วันที่ผ่านมา

      You're so welcome!

  • @andywatts
    @andywatts 9 หลายเดือนก่อน +1

    Thanks for sharing. Really great to see game-wide design patterns from an experienced hand..
    I'm gonna steal the setup script and input scriptable object. :)

    • @git-amend
      @git-amend  9 หลายเดือนก่อน

      Glad it was helpful!

  • @CyberStudios
    @CyberStudios 11 หลายเดือนก่อน +1

    🎉 absolutely amazed at this channel! Have yet to find something similar!! Keep it up. :D

    • @git-amend
      @git-amend  11 หลายเดือนก่อน

      Wow thanks!

  • @maxrandolph5437
    @maxrandolph5437 10 หลายเดือนก่อน

    Love this series so far... looking forward to the next one. I learned alot of editor and design concepts in a very short time :)

    • @git-amend
      @git-amend  10 หลายเดือนก่อน

      Glad you like them! Cheers!

  • @STARmod
    @STARmod ปีที่แล้ว +1

    Perfection, hyped for the series!

  • @hydroweapon
    @hydroweapon 9 หลายเดือนก่อน

    That setup script thing was awesome

    • @git-amend
      @git-amend  9 หลายเดือนก่อน +1

      Glad you liked that one!

    • @hydroweapon
      @hydroweapon 9 หลายเดือนก่อน

      the C# I know is all in-game related so it was refreshing to see something like that@@git-amend

  • @brodgers123
    @brodgers123 ปีที่แล้ว

    Good job, earned my sub.

    • @git-amend
      @git-amend  ปีที่แล้ว

      Awesome, thank you!

  • @Wellyngton-rm3bb
    @Wellyngton-rm3bb ปีที่แล้ว

    Awesome tutorial!

    • @git-amend
      @git-amend  ปีที่แล้ว

      Glad you liked it!

  • @Fitz0fury
    @Fitz0fury 9 หลายเดือนก่อน

    Quick note for those who may not use git: you may need to restart PC after installing even if git is running on your machine. According to the unity doc you only have to close out and restart the project and unity hub. that didn't work. i confirmed version and service before starting back up unity but it still didn't allow me to install from git. had to reboot the machine.

  • @tianqigao869
    @tianqigao869 ปีที่แล้ว

    awesome tutorial!

    • @git-amend
      @git-amend  ปีที่แล้ว

      Thank you! Cheers!

  • @meharofficial4284
    @meharofficial4284 ปีที่แล้ว

    Please do complete this series I am loving it and need help till end

    • @git-amend
      @git-amend  ปีที่แล้ว +1

      There is no 'end' per se, each series lasts as long as subscriber interest stays high. If you need help with a specific game mechanic however, let me know and perhaps it can be the subject of a future video!

  • @jeremyruizM42
    @jeremyruizM42 ปีที่แล้ว +1

    A 3D platformer series is nice, but what about the rail shooter? Is it finished? I want to add more to mine but I'm unsure of what to prioritize. What would you have added?

    • @git-amend
      @git-amend  ปีที่แล้ว +1

      Unfortunately for the Rail Shooter, not too many people watched the last video in that series.
      While all the core mechanics are done, I can think of 2 things that you could add to your own version: obstacles/pickups (things to collide with) and a UI/HUD. These topics were also covered in the Shoot 'Em Up game as well, which would be very similar.

  • @jukka-pekkalyytinen6558
    @jukka-pekkalyytinen6558 4 หลายเดือนก่อน

    I'm curious what sort of input are you using? What I keep hearing doesn't sound like a keyboard :D I appreciate the tutorials, I'm picking up a very professional vibe compared to a lot of other creators.

    • @git-amend
      @git-amend  4 หลายเดือนก่อน

      It's just a mechanical keyboard. In later videos you won't hear it at all because I started using Krisp AI for noise cancellation. Thanks for watching!

  • @GTZ-98
    @GTZ-98 5 หลายเดือนก่อน

    I’ve got another question, my char is not moving and I have no idea why because I’m pretty sure he should^^
    This might gonna be a long comment:
    
At this point we mainly use the Direction expression bodied Property (in the InputReader class) to get the X and Y values when we move the character via WASD. This input gets then processed in the moveDirection local variable in the HandleMovement Method in the PlayerController. This is already a problem in my case, since no matter what I press while logging I always get (0,0,0) in return. Which should not be the case because in other projects the exact same way of getting the input does work fine.
    If I am correct the UnityAction Move while being invoked from the OnMove, is doing basically nothing right not since nothing is subscribed to Move. OnMove on the other hand is subscribed to the Callbacks of the Action Map and therefor should at least fire when we hit WASD (which it doesn’t in my case) and if I log it I should receive a comment in the Console. Which I currently don’t get as well.

Is my thinking correct or am I wrong here? I really have no idea anymore why it does not work
    If you somehow manage to find some time and you want to look into this, here is a Google Drive Link to the project: drive.google.com/file/d/1_b-lVptEG_ygqWFFNr4nv6rBJkgpjk4f/view?usp=sharing
    Have a good rest of the weekend :)
    Edit: Okay this is super weird. I just went and put a Movement Property and a PlayerInputActions instance into the PlayerController and that worked. Then I noticed I was still logging the Movement from the InputReader class and that worked too, so I removed everything I implemented before and without changing anything, now everything is working fine. I can't believe it man, this is satisfying and unsatisfying at the same time because I still have no idea what was causing the error... Well at least I can progress now :D

    • @git-amend
      @git-amend  5 หลายเดือนก่อน

      Normally I do not have time to download and debug projects. However, I did download yours and opened it on my PC using Unity 6.000.0.1f1 - and the character moves around fine without having changed anything.
      I can only suggest a few things. 1) Do a complete Reload of your project by going to the top menu and selecting Assets > Reimport All. This will reimport all packages and assets in your project as if they are new. 2) Start debugging. Break it down bit by bit starting with the Player Input system until you find the source of the issue. 3) Eliminate the possibility that your hardware is the problem.

    • @GTZ-98
      @GTZ-98 5 หลายเดือนก่อน

      @@git-amend Wow thanks for the effort!

  • @irsy5892
    @irsy5892 2 หลายเดือนก่อน

    Hello @git-amend, do you mind to explain why did you differentiate the multiplier between deltaTime/fixedDeltaTime depends on whether the device is mouse or not?
    I apologize if this concept had been explained in your previous videos or if I missed it in this video itself. Thank you very much.

    • @git-amend
      @git-amend  2 หลายเดือนก่อน

      That's a very good question. In short, Time.deltaTime is a frame rate dependent value and subject to change. However, mouse delta values are already based on physical movement and are not inherently tied to framerate, so it's better to multiply by a fixed value - either fixedDeltaTime or some other constant value.

    • @irsy5892
      @irsy5892 2 หลายเดือนก่อน

      @@git-amend Ahh I'm with you, thank you! Your channel is such a goldmine btw.

  • @bino6251
    @bino6251 ปีที่แล้ว

    you are so awesome

  • @Trasqual
    @Trasqual 3 หลายเดือนก่อน

    Hey, awesome video again! I have a problem though, I can't find the Grounded state in any of the repositories, could anyone help?

    • @git-amend
      @git-amend  3 หลายเดือนก่อน +1

      There is no Grounded state. What are you referring to?

    • @Trasqual
      @Trasqual 3 หลายเดือนก่อน

      @@git-amend Sorry I wrote the comment under the wrong video, it was supposed to be under "Anatomy of an Advanced Player Controller". Problem solved the grounded state and all others were in the "States" file, my bad!

  • @GTZ-98
    @GTZ-98 6 หลายเดือนก่อน

    Hey, I started the series since I really liked the State Machine video. I've run into a problem tho, Since the last update of the Cinemachine the FreeLook Camera class is deprecated. At least that's what it says on the tooltip. You get told to use the CinemachineCamera instead. This however makes it impossible to select either the X or Y m_InputAxisValue which are solely members of the CinemachineFreeLook class.
    So the question is should I just use the CameraFreeLook or do you know a way to make it work with the CinemachineCamera class? (This is regarding the Camera Manager class at 19:51).
    PS: Oh and I am using the new Unity 6 preview version which could be a problem too I guess (but I think it should be fine, since the Cinemachine is a standalone package, right?),

    • @git-amend
      @git-amend  6 หลายเดือนก่อน

      That's a very interesting question - actually I have on my TODO list for today is to walk through the new Cinemachine 3.1.0 Samples and find out what's changed and improved. I'll get back to you on this.

    • @GTZ-98
      @GTZ-98 5 หลายเดือนก่อน

      @@git-amend Cool, thank you very much! :D

    • @git-amend
      @git-amend  5 หลายเดือนก่อน

      Check out this page, it basically outlines everything I would advise: docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/FreeLookCameras.html

    • @isaacj.p.7657
      @isaacj.p.7657 5 หลายเดือนก่อน

      @@git-amend It seems that to manually change values with the new version of cinemachine you have to get the CinemachineInputAxisController component which references the axis in an array. Unfortunately the InputValue of each axis appears to be the only value that you can't simply write to.
      Example syntax is CinemachineInputAxisController.Controllers[0].InputValue = cameraMovement.x * multipliers However, this doesn't work and I'm at a loss as to why.
      Controllers[0].Enabled = false works though so I may have to just switch the axis on and off when we enable/disable mouse look.
      Did you have any other insights when you looked into the new version?
      Fantastic videos by the way, thank you very much.

    • @git-amend
      @git-amend  5 หลายเดือนก่อน

      @@isaacj.p.7657 I don't have any great insights into that in particular, but I would suggest adding a layer of abstraction if you need to write to that axis array.

  • @ekekw930
    @ekekw930 8 หลายเดือนก่อน

    Hey! Great video once again. For some reason my ScriptableObject InputReaders OnEnable method doesnt get called and thus I have no input. I does get called when the scripts recompile however. Any idea?

    • @git-amend
      @git-amend  8 หลายเดือนก่อน +1

      One thing to keep in mind with instances of ScriptableObjects is that Unity does call OnEnable on ScriptableObjects after scripts are recompiled because it reloads the assets, which triggers the method.
      However, the method should also be called when you run the game. Make sure that is happening.
      The next thing to check is that your PlayerController is actually enabling the input actions by calling the InputReader.EnablePlayerActions() method from Start.

  • @Laura-po9mw
    @Laura-po9mw 4 หลายเดือนก่อน

    Thank you a lot for this videos, they've helped me a lot. Anyways i wanted to use the Rebind system from InputSystem, how could I implement this without breaking up the InputReader script? I know I need to replace the
    HeroInputActions inputActions;
    for
    PlayerInput inputActions;
    Since the Rebind system uses the Player Input (you bind the HeroInputActions into it) but then everything else stops working. The only change that I manage to make it work is
    public Vector3 Direction => inputActions.Player.Move.ReadValue();
    for
    public Vector3 Direction => playerInput.actions["Move"].ReadValue();
    but for the rest of the events I can't manage to make them work 😥 if anyone could help it would be amazing.
    Thanks a lot and sorry if it is something easy to solve, I've been looking how to do this for days and I'm stucked 😅

    • @git-amend
      @git-amend  4 หลายเดือนก่อน +1

      I think this is a question you'll potentially get more help on Discord with than in the comments - there's a link in the 'About' section of the channel.

    • @Laura-po9mw
      @Laura-po9mw 4 หลายเดือนก่อน

      @@git-amend Thank you! I'll ask around 😊

    • @Laura-po9mw
      @Laura-po9mw 4 หลายเดือนก่อน

      In case anyone had the same problem as me, you only need to bind your actions like this!
      playerInput.actions["Move"].performed += ctx => OnMove(ctx);

  • @GraysonScott-o4n
    @GraysonScott-o4n 13 ชั่วโมงที่ผ่านมา

    Trying this awesome tutorial but getting (CS0618: Class 'Unity.Cinemachine.CinemachineFreeLook' is obsolete: 'This is deprecated. Use Create -> Cinemachine -> FreeLook camera, or create a CinemachineCamera with appropriate components') Free Look V Cam field does not accept the Cinemachine freelook camera. Any fix or suggestions? Downgrade Cinemachine version? Satanic rituals?

    • @git-amend
      @git-amend  13 ชั่วโมงที่ผ่านมา

      This is an older video that uses Cinemachine: 2.9.7
      If you want to get familiar with the new Cinemachine 3.1 and use that instead watch this: th-cam.com/video/4xd37R1spKw/w-d-xo.html

    • @GraysonScott-o4n
      @GraysonScott-o4n 13 ชั่วโมงที่ผ่านมา

      @ I’ll downgrade and use that version, thanks!

  • @eugeniogenuinomota681
    @eugeniogenuinomota681 4 หลายเดือนก่อน

    i am a complete begginner in Unity and i am using all the default stuff, what is the tool that opens when you enter a script? mine is VS Code but i dont think i can follow the tutorial using it.

    • @git-amend
      @git-amend  4 หลายเดือนก่อน

      You can use VS Code, there's nothing special about my editor as it relates to the video. But for what it's worth, I'm using JetBrains Rider. At the moment you can get a free copy of it in the early access program if you want here: www.jetbrains.com/rider/nextversion/

    • @eugeniogenuinomota681
      @eugeniogenuinomota681 4 หลายเดือนก่อน

      @@git-amend thank you, i asked because you were doing stuff i had no idea how to do when creating the setup to create folder automatically, and i thought it was the editor

    • @git-amend
      @git-amend  4 หลายเดือนก่อน

      @@eugeniogenuinomota681 This channel is definitely geared towards devs who are ready to move beyond the beginner stage, so you may face some challenges as a total beginner. Not that you can't do it, but you may have to check the video comments for obstacles other beginners have faced, and of course the source code is also available in the description.

    • @eugeniogenuinomota681
      @eugeniogenuinomota681 4 หลายเดือนก่อน

      @@git-amend thank you, i was actually really excited for the tutorial for that reason, you seen to be very experienced and i am really wanted to learn what you were doing, its for a school project.
      Unfortunately, i dont have a lot of time for searching and stuff, so really i just wanted to make a game as quick as possible lol, just to show to my teacher.
      i tried downloading the source code, but since i dont fully understand it its kinda hard to work with, like adding certain components and stuff

  • @jamestanubrata6782
    @jamestanubrata6782 6 หลายเดือนก่อน

    How do you do when doing an animal controller

    • @git-amend
      @git-amend  6 หลายเดือนก่อน

      Actually I use Malbers Animal Controller from the Asset Store for that, it's excellent.

  • @sk8ersrok366
    @sk8ersrok366 8 หลายเดือนก่อน

    What IDE do you use?

    • @git-amend
      @git-amend  8 หลายเดือนก่อน

      JetBrains Rider

  • @blazingpotato642
    @blazingpotato642 ปีที่แล้ว +1

    do you have a discord server?

    • @git-amend
      @git-amend  ปีที่แล้ว +3

      Not an official one yet, something to consider!

  • @jasperstevens8454
    @jasperstevens8454 25 วันที่ผ่านมา

    My character walking animation isnt working and im getting an error saying "Parameter 'Hash -823668238' does not exits. UnityEngine.Animator:SetFloat (int,single)". PLS HELP! I CANT GO ON LIKE THIS!!

    • @git-amend
      @git-amend  25 วันที่ผ่านมา +1

      The error you're encountering typically means that Unity's Animator is trying to set a parameter using a hash value for a parameter that doesn't exist in the Animator Controller. The Hash -823668238 refers to a parameter that was either:
      a) Not created in the Animator.
      b) Removed or renamed after the code was written.
      c) You have a typo in the name of the parameter
      In the Animator Controller, go to the Parameters tab and make sure the parameter that the code is trying to set exists. The parameter might have been deleted or renamed. Then verify that the parameter name used in your code matches exactly with the name in the Animator Controller.

    • @jasperstevens8454
      @jasperstevens8454 19 วันที่ผ่านมา

      @@git-amend I didn't really under stand what you said, but i realized i wasn't making it in Universal 3D so i made a new project in URP and now it works!

  • @asgorathalpha8316
    @asgorathalpha8316 หลายเดือนก่อน

    My character won't turn with the camera or when I hit 'A' and 'D'. Any idea why this could be happening? I've reviewed the video and I think that I've followed the tutorial exactly.
    Edit: After switching to a rigidbody (part 2 of this series) the character now turns. No idea why.

  • @SumitShrestha-di1vl
    @SumitShrestha-di1vl 4 หลายเดือนก่อน

    you are too high level man yu teach the dopest shit but please start from intermediate

    • @git-amend
      @git-amend  4 หลายเดือนก่อน

      This is intermediate. Go watch the Event Bus video and then come back here and this will seem easy!