Unity - 2D Melee Combo System Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ม.ค. 2025

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

  • @SMHillDev
    @SMHillDev  ปีที่แล้ว +11

    Hey, wanted to make this pinned to first say thanks for all the support on the video! I'm planning on making more content like this and content in general very soon.
    I would also like to clarify an issue I've seen with builds. I didn't run a test build verifying the system (rookie mistake I know) so you might see these.
    - The OnValidate function doesn't get called inside of builds, so you should move the logic that sets your mainStateType dynamically into the top of the Awake function. I suggest putting it in its own function for ease of use in both editor and build cases. And thank you to all those who have pointed it out.

  • @phantomredstudios
    @phantomredstudios 2 ปีที่แล้ว +4

    Beat me to the FSM combo tutorial. I was just talking to my spouse about doing one and this got recommended to me randomly. I'm about two months late to the party. Good stuff. My only critique, I would cut out the animator since you already have a FSM you are working with.

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

    I really appreciate that you help people with free apps

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

    the quality of this video is insane, thank you for this

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

    damn how you make videos this good with only about 300 subs that's crazy

  • @utyflby
    @utyflby 2 ปีที่แล้ว

    TNice tutorials is by far the best soft soft basic tutorial, I rember when I just started learning, tNice tutorials was so helpful!! I’ve now been releasing edm

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

    you are not like the others who puts link filled with adds, so u deserve to be subscribed..... thanks for the plugin and all the best for future

  • @718phungngocgiabao4
    @718phungngocgiabao4 2 ปีที่แล้ว

    My man's dedication is over the top!

  • @duyvo1258
    @duyvo1258 2 ปีที่แล้ว +4

    Thanks a lot dude! This is heavily underrated tutorial, you taught the fundamental which is easy to understand, I will follow and implement it in my project but with different hitbox managing approach. Anyway, one sub and nice day!

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

    Really great stuff! Looking forward to more from you. Subbed!

    • @SMHillDev
      @SMHillDev  2 ปีที่แล้ว

      Awesome, thank you!

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

    Gonna ramp up in subs real quick, keep it up! Great tut!

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

    You have not nearly enough subscribers for how good ur videos are man

  • @tekmontekmon8098
    @tekmontekmon8098 2 ปีที่แล้ว

    Best soft soft Introduction Ever!!

  • @ericrichard9854
    @ericrichard9854 2 ปีที่แล้ว

    man you should have more subscriber, this is high quality vids good job!

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

    I have been trying for a while to add a parameter of the animator in an animation to modify its value as you do in minute 15:32, but I can't manage to do it. When I hit Add Property in the animation, the Animator component of the Gamebject is not shown.

  • @jaztiryzer06
    @jaztiryzer06 2 ปีที่แล้ว

    man it is the best thing I have ever seen

  • @mariaalejandranogalesborda2284
    @mariaalejandranogalesborda2284 2 ปีที่แล้ว

    Excellent video. Clearly explained all the basics to get started on soft soft. Thanks

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

    My dude this is soooo good! Instant sub!

  • @ohaidavid1739
    @ohaidavid1739 2 ปีที่แล้ว

    Hey Bro, Don't talk down to yourself like that. believe in yourself and don't let nobody change your mindset of that!

  • @quickunity3543
    @quickunity3543 2 ปีที่แล้ว

    Great tutorial man, I am starting to make videos myself! Good luck!

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

    Very well done video, gets to the point fast. Cheers!

  • @MarceloCSC
    @MarceloCSC 2 ปีที่แล้ว

    Amazing tutorial. You should keep posting, man! It's been awhile.

  • @polski6812
    @polski6812 2 ปีที่แล้ว

    What a great video, helps A LOT in the beginning.

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

    amazing tutorial bro! this is perfect. I learned a lot, and you explained things really well. i wonder what you're up to now? did you get a job in the tech field?

  • @zullismairethacunaolivella1437
    @zullismairethacunaolivella1437 2 ปีที่แล้ว

    wow thank you so much. no joke it is now so much easier and u explained it really good.

  • @warpzone8421
    @warpzone8421 ปีที่แล้ว +3

    Found a bug. I compiled this using 2022.3.5, and it works fine in the editor, but when I build the game, clicking the mouse doesn't do anything. Which is strange, since you're just using Input.GetMouseButtonDown and there aren't any special extra input packages being used. When I googled it, I found a Unity forum thread with like 30 different solutions that were all use-case specific. Why is something as basic as clicking the mouse so fragile in Unity though?

  • @LucasDevWeb
    @LucasDevWeb 2 ปีที่แล้ว +4

    Hi Sean, state machine it doesn't work when i do the build, I can't find the solution.

    • @LucasDevWeb
      @LucasDevWeb 2 ปีที่แล้ว

      NullReferenceException: Object reference not set to an instance of an object
      at ComboCharacterState.Update () [0x0001c] in :0

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

      @@LucasDevWeb did u solve the issue?

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

      ​@@LucasDevWebit seems like that you haven't assigned something

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

    Aah this is helping me so much! Thank you! I haven't finished but I can tell this is probably going to work. TYSM! I subbed

  • @madhavsolanki6464
    @madhavsolanki6464 2 ปีที่แล้ว

    studying more of your videos to begin to get comfortable. Thank you!

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

    This will be very helpful for my project. Thanks !

  • @USA-RPA
    @USA-RPA 2 ปีที่แล้ว

    Great video, VERY easy to listen to you and follow along. Please keep videos coming... subbed for sure!

  • @EmanuelRZM
    @EmanuelRZM 2 ปีที่แล้ว

    When I've started producing I personally have downloaded most of the plugins from there, never had problems with virus, malwares and

  • @jummisammi
    @jummisammi 2 ปีที่แล้ว

    Thanks, man! Just what I was looking for!

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

    Great video try tutorial!! Keep up the Good Work!

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

    Great video, excellent pacing and concise but poignant descriptions.

  • @ItsAkile
    @ItsAkile 2 ปีที่แล้ว

    Thanks, Gonna sink my teeth into this for the first time this week. I already have a base idea of what I want to accomplish

  • @kumailthecuber7477
    @kumailthecuber7477 2 ปีที่แล้ว

    unbelievably well explained...to the point, no wafsofte wafsofte chat...you´re the dude ..thanks!

  • @LordHinson
    @LordHinson 2 ปีที่แล้ว

    it works perfectly! Thanks buddy

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

    this rlly fkin awesome. subbed

  • @alanzack---amv8558
    @alanzack---amv8558 2 ปีที่แล้ว

    OMG, it really worked. Thank you so much!!

  • @blades575
    @blades575 2 ปีที่แล้ว

    Great stuff. Thanks for sharing!

  • @frankypappa
    @frankypappa 2 ปีที่แล้ว

    Nice work. Subbed! 👍🏾👌🏾

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

    In the ComboCharacter file I keep getting errors for meleeStateMachine.CurrentState. It tells me the object reference is not set to an object. If I already instatiated the object meleeStateMachine as a private object how could it not exist? Please help I think Im close because when I comment out the reference to meleeStateMachine I am able to get attack 1 out by clicking.

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

    I NEED to know what Visual Studio theme this is- it looks awesome

  • @mrnick8361
    @mrnick8361 2 ปีที่แล้ว

    LOOOL YESSSSSSSS TNice tutorialS COMNT IS FELTTTTT

  • @katsutwo5051
    @katsutwo5051 2 ปีที่แล้ว

    Really good work

  • @Ghareebz
    @Ghareebz 2 ปีที่แล้ว

    dude that's insane ,

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

    What a smart Young man, thanks

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

    How beatiful algoritm.. Amazing

  • @jeffreyhendricks3428
    @jeffreyhendricks3428 2 ปีที่แล้ว

    thank you so much for posting these good videos

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

    Good tutorial! Though my GroundEntryState seems to go to the GroundComboState even when i dont hit the button. Any Ideas on why this could happen?EDIT: Nevermind t fixed itself through the Attackwindows...

  • @toastymctoast3672
    @toastymctoast3672 2 ปีที่แล้ว

    very very gooood, thaaankss maan

  • @karaliseklers2531
    @karaliseklers2531 2 ปีที่แล้ว

    thank you so much for sharing this method with !

  • @textilesgranfe8940
    @textilesgranfe8940 2 ปีที่แล้ว

    thank you straight to the point

  • @venenopp
    @venenopp 2 ปีที่แล้ว

    Can�t wait to go out tonight and celebrate your birthday. But first of all, accept my warmest wishes and gratitude for being my brother.

  • @boris345678
    @boris345678 2 ปีที่แล้ว

    Actually legit. Thanks!

  • @raymondnielsen7125
    @raymondnielsen7125 2 ปีที่แล้ว

    YIPPEE!!! Happy day. Thank You, Funny Animals Club!

  • @fenerix3911
    @fenerix3911 2 ปีที่แล้ว

    This really helped thanks a lot!

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

    how is GetComponent supposed to work inside the MeleeBaseState class if it does not inherit from MonoBehaviour ?

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

    This is great tutorial! i'm looking about 2d melee combo tutorial for a while. but i have a problem. the character is changing from GroundEntryState to GroundComboState immediately(i just click 1 time but character's animation is transit from Attack1 to Attack2 by itself), I tried to look at the scripts, Is there any way to solve it?

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

      I have the same Problem

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

      Just Continue the Tutorial it Fixes itself with the AttackWindows... :)

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

    Hey man, great tutorial,
    I have a small question, my character is going from Idle to Attack1 to Attack2 from one click only I can't know why.
    I tried adjusting the attack window to the last frame of Attack1 animation, but now it's no longer going to Attack2, most probably because of the small window.
    What's the issue ? I followed the video step by step even the github repo.

  • @Momazosgoofy
    @Momazosgoofy 2 ปีที่แล้ว

    u see that little cog option button on the bottom near the fullscreen button? if u click on that u can chose to slow it down or speed it up. i

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

    fucking legend, this is so well done

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

    The combat system doesn't work after I built my project. The player character doesn't respond after the attack input. But it works fine in the Unity Editor. Any ideas why?

    • @iop313
      @iop313 6 หลายเดือนก่อน +1

      Yea it happend time to time to me also
      U need more updated videos u can try one of two things
      1. typing ur own code (The some thing could happend)
      2. finding more updated tutorial when unity tutrial get 2years or much older it don't working usally even visual tell u all good (But tip for me check ur unity project be4 u deleting ur code maybe something there is worng)

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

    Holy shit, thank you so much!!

  • @fikus5567
    @fikus5567 2 ปีที่แล้ว

    Good guide for beginners)

  • @georgigeorgiev9966
    @georgigeorgiev9966 2 ปีที่แล้ว

    I don't know what i am doing wrong but my character only repeats the first attack animation without clicking or doing anything?

  • @jaopaulo7095
    @jaopaulo7095 2 ปีที่แล้ว

    nice tuto Thank you!

  • @macawls
    @macawls 2 ปีที่แล้ว

    Thanks King

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

    how would i do this with the new input system?

  • @Santosxis7
    @Santosxis7 2 ปีที่แล้ว

    i downloaded. its works :)))

  • @kidspets8353
    @kidspets8353 2 ปีที่แล้ว

    i will play this game all day long

  • @jepoystv7396
    @jepoystv7396 2 ปีที่แล้ว

    Thank you, it means a lot:)

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

    Thank you buddy

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

    This tutorial was great but im having problems with getting the attack to work and i have no compiler errors

  • @koelgamer6304
    @koelgamer6304 2 ปีที่แล้ว

    The reason for my asking, is due to crackling/distorting soft, whenever the drum/snare, or whatever is playing. TNice tutorials was the case off

  • @reaporofdragon744
    @reaporofdragon744 2 ปีที่แล้ว

    thanks i did a similar system from a course but you could only damage one enemy at a time and having 5 enemies rushing you and only hitting 1 seems unfair XD thanks now i can make it more like a survival instead of a platformer

  • @luqigongchang6213
    @luqigongchang6213 2 ปีที่แล้ว

    How did you get the effects chain on the left side of the setuper?

  • @alexisyvandolosa3831
    @alexisyvandolosa3831 2 ปีที่แล้ว

    "The softs in these softs are gonna be sent to the setuper"

  • @faqihwicaksono2015
    @faqihwicaksono2015 2 ปีที่แล้ว

    Thank you tNice tutorials really helped!!!!!!!!!!!!

  • @Kiennvit
    @Kiennvit 2 ปีที่แล้ว

    thank you good sir

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

    getting nullreference error in build only, any clue how to solve it? seems currentstate and nextstate are missing

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

      same bro
      HELP LOL

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

      @@pokefesterJr the onvalidate func doesn't get called in buid, sorry for late reply dude

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

      @@peterhe2872 np, thanks for the reply. I found out about the on validate after scrolling through the comments some more

  • @Onyx-n4u
    @Onyx-n4u 2 ปีที่แล้ว

    In the setup, appreciate the videos! Maybe a dumb question but is there a way to export content in mono in soft20?

  • @ggplayer1170
    @ggplayer1170 2 ปีที่แล้ว

    Great stuff, would love for you to make a tutorial on how to make a simple fighting game

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

      Noted! Though, even though this is more geared towards action platformers/metroidvania's, this pretty much is all you'd need to make the core of a fighting game. Alot of the stuff I'd do in that is covered here already for the most part.

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

      @@SMHillDev Hi
      The hitboxes and hurtboxes in fighting games are a lot more complicated, since they require more precision than just a single box collider. Making hitboxes without the use of Unity box colliders seems undocumented?
      The state machine would work the exact same way though, yeah.

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

      Ah you want a tutorial on Hitbox groups then. I could totally add that to my list. Though in the meantime you might want to look at Unity's Bounds class. Its what unity colliders use for its collision functionality and what I use when I'm trying to avoid using them for whatever reason I might have.
      Bounds: docs.unity3d.com/ScriptReference/Bounds.html

    • @ggplayer1170
      @ggplayer1170 2 ปีที่แล้ว

      @@SMHillDev Oh they're called Hitbox groups? I didn't know that, thank you for the pointers!

  • @swiftcreations
    @swiftcreations 2 ปีที่แล้ว

    What about implementing the input to use the Unity New Input system, instead of mouse 0?

    • @SMHillDev
      @SMHillDev  2 ปีที่แล้ว

      What about it?
      That depends on your use of it/how you implemented it. If you're asking what the new unity input system equivalent of Input.GetMouseButton(0) is in the new Unity Input System its Mouse.current.leftButton.wasPressedThisFrame.

    • @reaporofdragon744
      @reaporofdragon744 2 ปีที่แล้ว

      or just go into the settings and use both input systems

  • @nicolasniboldi3815
    @nicolasniboldi3815 2 ปีที่แล้ว

    thank you so much

  • @charbelboughazale3994
    @charbelboughazale3994 2 ปีที่แล้ว

    NICE

  • @David-oc8yt
    @David-oc8yt 10 วันที่ผ่านมา

    Well on the way to MORTAL KOMBAT!!! 😊

  • @parappaaaaa...8864
    @parappaaaaa...8864 2 ปีที่แล้ว

    Hey i dont know why but when I start the game the animation is working but the Character doesn't return to idle when I click it only does the attacks and stop when the animation is done... Not returning to idle... I am pretty new to Unity animation so... Idk what I did wrong?

    • @khnuxsora
      @khnuxsora 2 ปีที่แล้ว +2

      you probably set conditions from the attack to idle...i think if you remove them it should work

  • @kakarot_1996
    @kakarot_1996 2 ปีที่แล้ว

    of ti...cheers!

  • @nbzcik
    @nbzcik 2 ปีที่แล้ว

    Thanks I love you

  • @nosocialismturtle.2891
    @nosocialismturtle.2891 2 ปีที่แล้ว

    Hey, so how to make the enemy die?

  • @marwanonthemoon876
    @marwanonthemoon876 2 ปีที่แล้ว

    This is a very interesting approach to a melee combo system, I'd love to mess around with it but I wanted to pick your brain a bit before I do so. How do you see this interacting with the movement (character controller), think I should set a bool that stops the character from moving when an attack is initiated or do I have to convert the character controller altogether into an FSM?

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

      The power of the fsm is it can run asynchronously with your characters other logic. So yeah your approach could totally work as long as you have a reference to said character controller. This approach was taken with that in mind cause some games stop all movement (much like you want to) for a quick hit pause, some slow momentum, and others don't care at all. My approach is similar when I need to halt movement where I have a bool to stop accepting inputs on my character controller and then zero out velocity of them in OnBegin. If I want momentum to continue after a hit, I cache said velocity in OnBegin and then reset it back to what it was in OnEnd.

    • @marwanonthemoon876
      @marwanonthemoon876 2 ปีที่แล้ว

      @@SMHillDev I haven't thought about the velocity cache thing, that's pretty dope! one other question, I noticed you created a new layer in your animators and then deleted it, was that by mistake instead of parameters? I never used the layer thing in animator so I'm not sure what it does

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

      @@marwanonthemoon876 Yeah that was a mistake. Layers are really only useful for 3D games or if you're using 2D Vector animation (I.E Working with skeletons/bones.) Its used for managing complex states for different bone groupings for blending as well as organization. You can also use them for traditional 2D (For the sole purpose of organization) as well but those cases are normally if you have a massive anim suite with a ton of states.

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

      @@SMHillDev Ah thanks so much for the explanation dude, very helpful stuff!
      I'm working on implementing an air melee combo now, just wanted to run things by you (sorry for asking so many questions!) so I changed the ComboCharacter to switch to MeleeEntryState() instead of Groundstate, where I'll be doing the cheques, but I was wondering, if the player jumps midway of the combo what is going to happen? (would the ground check be okay in MeleeEntryState, or where should it be?)

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

      In this particular setup its mostly dependent on what you what you want to happen. If the player jumps midway of a combo it would in this case (based on what's already there) continue to fire off whatever states set combo you're in if you were to continue hitting the attack button.
      What you can do is either don't allow the player to jump during (Its what I do with disabling movement inputs). This makes it so that you won't be accepting any until an attack is fully done and the FSM has reset so it goes back to the entry state.
      Or add in an extra check for grounded when deciding which state to fire off next, sending it back to MeleeEntryState if you want, or a specific attack of your choosing. I do this as well, since I know my player can't jump I allow for an uppercut mid melee ground attack, checking to see if a specific input is fired and swapping midway.

  • @adriananakazawa2116
    @adriananakazawa2116 2 ปีที่แล้ว

    Works

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

    Is it expensive to call new for every state transition?

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

      I haven't run it through a profiler, but I assume it's fine seeing as the class itself is pretty lightweight.
      Though this system could use some optimization I have tested it with dozens of game objects at a time all running various logic ontop of the statemachines and haven't seen any issues linking to it.

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

      Thanks for the quick reply, I guess there is a lot of difference when instantiating pure C# class and monobehaviour class

  • @moisesnunes55
    @moisesnunes55 2 ปีที่แล้ว

    Try to see soft design , composing and setuping as three seperate tNice tutorialngs to focus on and it might will make more sense

  • @mir4_cansada200
    @mir4_cansada200 2 ปีที่แล้ว

    Sooo trueeee

  • @miguelbroca3243
    @miguelbroca3243 2 ปีที่แล้ว

    nice

  • @khnuxsora
    @khnuxsora 2 ปีที่แล้ว

    i got error CS1503 Argument 1: cannot convert from 'GroundComboState' to 'State'

    • @SMHillDev
      @SMHillDev  2 ปีที่แล้ว

      Did you make sure that GroundComboState derives from MeleeBaseState (GroundComboState : MeleeBaseState) which also derives from state (MeleeBaseState : State) ?

    • @khnuxsora
      @khnuxsora 2 ปีที่แล้ว

      @@SMHillDev oooh yeah i did it now.....but i have the same mistake for State Manager : StateMachine.cs(76,33): error CS0029: Cannot implicitly convert type 'IdleCombatState' to 'State'......

    • @SMHillDev
      @SMHillDev  2 ปีที่แล้ว

      Same thing, did you make sure that IdleCombatState derived from State? (IdleCombatState : State)

    • @khnuxsora
      @khnuxsora 2 ปีที่แล้ว

      @@SMHillDev ...i feel stupid...xD anyway thank you so much

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

      No problem! If you have any other issues you run into you can always check your code base against mine, I have the entire project I make in the video up on github (link in the description).

  • @parappaaaaa...8864
    @parappaaaaa...8864 2 ปีที่แล้ว

    Hey man everything works fine now... But the attack animation starts a little slow at first when I click it, it takes a second to respond ... Is there any way to solve this?

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

      My best guess is you forgot to set exit time for the transitions to 0 from Any State to your attack. If you have any exit time on any of those states it waits for the idle animation to finish a complete cycle first before firing off any animations.

    • @sora1804
      @sora1804 2 ปีที่แล้ว

      @@SMHillDev it gives me using or assembly error while switching the MonoBehaviour to State