Creating an easy Ability System in Unity

Поділитися
Вставка
  • Опубліковано 1 тра 2021
  • This video shows you how to make a simple Ability System for all kinds of games in Unity. The system can be expanded easily and it allows you to change abilities in run time.

КОМЕНТАРІ • 155

  • @barnesnplebian6462
    @barnesnplebian6462 2 роки тому +47

    I have a feeling this kid lives down the street from Brackeys

  • @crashcabinet
    @crashcabinet 13 днів тому

    Thank you so much this is actually the best video on UA-cam for this exact topic. Been pulling my hair out a few days now within 90% of an rpg alpha and no idea how I was gonna do abilities!!!

  • @Rovsau
    @Rovsau 2 роки тому +14

    The algorithm really needs to appreciate your 10/10 video format.
    These are the tutorials we are looking for. Great job!

  • @diovannie81
    @diovannie81 3 роки тому +11

    Brief explanation, decent edit, & clear voice. You simply awesome bro.
    Subbed. Here's love from Indonesian gamedev

  • @Simon_Laserna
    @Simon_Laserna Рік тому +10

    Great content, and fantastic format. You show everything, explain it, and you do it quickly while highlighting important things with editing. Great work.
    Good luck with your future, and thank you for the video!

  • @kboltiz
    @kboltiz Рік тому +5

    love the code architecture!
    It's what I look for in tutorials, and you provided!

  • @antoine_9667
    @antoine_9667 9 місяців тому +8

    it makes more sense I think to make the Ability class abstract as you can never have just an, ability and it would allow you to declare abstract method for activate and startCooldown which is cleaner than declaring an empty method implementation and would be overriden the same way; besides that great video ! keep up the good work

  • @arsenbabaev1022
    @arsenbabaev1022 2 роки тому +59

    I never thought that scriptable object can inherit from base class. This is amazing solution. Before i had ability scriptable objects with 30+ varibles (most of them unused for particular ability).
    P.S. Im impressed with editing and video quality for your small channel, for sure keep it up.

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

    10/10 for making scriptable objects make sense. I've watched 8 of these and couldn't implement what I wanted to until now.

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

      I'm very glad, that I could help you so much!

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

    Excellent! Super simple and powerful implementation!

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

    Amazing video and tutorial! Used it as a base for an ability system I am working on.

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

    This video really solved a lot of problems thanks. You’re so smart!

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

    Very clean and crispy tutorial. Thank you

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

    What I like about this is the simplicity, I can expand on this which is very nice.

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

    THIS TUTORIAL REALLY WORKS I AM FROM PHILIPPINES! THIS MAN DESERVES A SUBSCRIPTION!

  • @ginnvan4897
    @ginnvan4897 Рік тому +1

    It worked for my 64-bit PC. Thanks a lot.

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

    This is really good way of doing ability system. I am so thankful that this kind of stuff is available for free. I will also create similar system for passive abilities, that don't need activations or cooldowns.

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

    Amazing work, thanks for sharing this knowledge.

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

    I found a masterpiece, much love from Philippines 🇵🇭💕

  • @s1eepy0130
    @s1eepy0130 11 місяців тому

    Thanks for the tutorial, you explanation was clear and good enough, which really helps a lot even tho for a beginner like me.

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

    Thank you very much, this video helped me solve a problem on which I was stuck for days!!.
    Keep Growing!

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

    Thanks for your good content. It's also very easy-understanding.

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

    Thanks for sharing your valuable experience.

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

    that was exactly what I needed , thank you so much

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

    that was exactly what i was seraching for since a whole week! such a good videowit good explenations. thx for this

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

      I'm glad I could help you!

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

    Many thanks for this video, it really helped me out

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

    Thank you for the tutorial. Now I just need to figure out how to make it work with the next input system.

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

    amazing your content is very niche and usefull keep posting

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

    Genial vídeo, super simple y efectivo.

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

    Fantastic video bro, legend.

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

    Amazing tutorial, nice to hear a german explaining it so clearly

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

    Very nice tutorial bro. Keep it up

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

    Find das System sehr gelungen und versuche es gerade anzupassen. Hab vorhin "How To Make Your Game Feel Better" reingespült bekommen, auch ein Top Video - man erkennt den Twist in deiner Stimme tho.
    Ich habe absoluten Respekt für sowohl die Knowledge, deine Englischkenntnisse und dann auch noch die Qualität und das Arrangement deiner Videos. Alles auf den Punkt, kompakt und professioneller als die meisten anderen Tutorials die man so findet.
    Würde ich als gegeben hinnehmen, guter UA-cam-Kanal eben, aber wenn man dann noch das jung anmutende Alter in Betracht zieht.. ich bin mir selbst ja zu Schade, diesen Kommentar auf englisch zu verfassen..
    Hochachtung, danke für die Videos, weiter so :)

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

    Very clean video

  • @csr3846
    @csr3846 2 роки тому +4

    Great tutorial. Would love to see how you would make this into a flexible buff/ability system with UI and several cooldowns running.

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

    If you change a variable value on runtime it stays that way because it is a scriptable object. Having to redo my skill system because I didn't know that. this is a great video

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

    This will be very helpful

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

    Great video. Keep it up

  • @karficzfrizack2711
    @karficzfrizack2711 4 місяці тому

    Thanks!

  • @kurrandor
    @kurrandor 8 місяців тому

    Bruder sehr gutes Tutorial, danke :D

  • @user-vr2zw7rk8w
    @user-vr2zw7rk8w 11 місяців тому

    Thanks you from Korea

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

    Amazing video and also what font are you using in the video?

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

    wow that's content! you deserve as many viewers as btp or something

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

    Great video

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

    Nice tutorial :)!

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

    Great stuff, keep it up!

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

    Hey, thanks for the tutorial! How would you go about having multiple hotkeys for multiple spells at the same time, using the AbilityHolder script?

  • @Ghost13-
    @Ghost13- 2 роки тому

    that was very nice

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

    If I want to use a function inherited from the MonoBehaviour class in script DashAblity, do I need to change it to create a variable on the Field to receive a value that is a ScriptableObject?

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

    Can you please show how to make a damaging ability, like shooting homing missiles when a key is pressed

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

    Thanks to you

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

    But, if more than two entities has the same reference to the ability scriptable, Are both getting the velocity boost?

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

    Good Video

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

    How is it possible that your ball moves at linear speed when in the FixedUpdate of PlayerMovement you are constantly adding to the velocity?

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

    I figured out how to do everything up to the actual dash ability script with the new input system. Any ideas on how to make the dash ability script work with the new input system? having a lot of trouble

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

    Will there be an error if you remove [CreateAssetMenu] after making the scriptable object? I havent gotten one yet but I want to avoid major errors before hand...

  • @DavTalks.
    @DavTalks. Рік тому

    I'm very new to coding and unity in general ,so I know this question might be dumb.So my question is how do I add animations specifically for this type of an ability and does this type of ability apply to making projectiles just with some minor changes to the code?

  • @karlbeats4026
    @karlbeats4026 4 місяці тому

    how about when you add more abilities? with different cooldowns

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

    Verdammt gut und Informativ.
    Holy Shit. Just clicked on a newer Video and the Voice just flashed me xD

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

    hi! how can Instantiate an object that follow enemy im having problem about "transform does not exits in current context"

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

    I will use this! :D

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

    great video! but how does it work exactly?
    why would a class that inherits from ScriptableObjects behave like a Monobehavior? (be able to use methods like Update())

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

    Wow, that switch case with input inside will lead to huge spaghetti code.

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

    Tried setting state to cooldown as default but it always switched to active automaticly, which is so odd

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

    Can you show a show how to make a movement script, your player's movement looks so smooth

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

    I'm very thankful for your video! However, I am having an issue. Whenever I get into my dash ability script, a red squiggle appears under normalized. It says bool does not contain definition for normalized. Is there a way to write this dash ability not using the normalized function? we used a verticalMovement bool using key presses

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

      Thanks! The problem is that you have to convert the bool vertical Movement into a Vector, so you can normalize it. Normalizing is quite important so the dash has the same amount of speed in every direction. I don't know how your code works with a bool as your input but you should be able to turn your input in a vector.

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

    This is an incredible and concise video, it swiftly and correctly explains concepts that many beginning game designers struggle to comprehend. Great job, glad I found the channel.

  • @Arcann_bhp
    @Arcann_bhp 9 місяців тому +1

    My brain blew up mid tutorial

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

    :D very helpful vid ty u !!!

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

      im excited to see more videos : )

  • @QuocNguyen-kb1kn
    @QuocNguyen-kb1kn Рік тому

    Take a drink every ti he says “to stay super organized “

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

    This is such a great video! But how would I create an ability that summons a shield or shoots a raycast?

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

      Thank you!
      I would create a shield ability by just instantiating (Object.Instatiate) a shield game object where ever you want it to be.
      And for raycasts the same thing. Just create a raycast and save its hit data as a variable and do what ever you want.

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

    Was this mean that for every ability, I need to create another script that will inherit the Ability Class?

  • @cameronfisher1786
    @cameronfisher1786 Рік тому +1

    Don't know if you'll ever see this, but how would I go about giving the player multiple swappable abilities? My plan is to make a menu where they can choose their abilities and then hit an apply button that sets their abilities to the ones they selected. Any help is appreciated, thanks.

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

      Maybe use some kind of collection for abilities and based on the index of chosen ability assign it to the player :)

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

    Awesome tutorial but I’ve been wondering can you visualize the cooldown?
    And also can you make the ability follow your mouse and not the direction that your character is moving?

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

      Yes, it's possible to visualize the cooldown. The AbilityHolder could have a reference to an UI Slider. On Update the Slider value can be set to cooldownTime / ability.cooldownTime.
      If the dash should go in direction of the cursor, the ability needs to get movement.directionToMouse(for example) instead of movement.movementInput.
      Hope that answered your questions :D

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

      @@timberdev Thanks, Im so grateful that we have people like you it restores my faith in humanity!

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

    hey man nice video!
    i was wondering if u have a link to download your color theme? is it regular vs or vs code?
    thank you

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

      Hi, I am using VS Code and the theme is named "One Monokai". I hope that helps you!

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

      @@timberdev yep, thank you!

  • @Basil13ful
    @Basil13ful 9 місяців тому

    could be nice to set abstract Ability and its method Activate, to force the implementation of the method in its child scripts

  • @jaybehl7567
    @jaybehl7567 3 місяці тому +1

    Fantastic Video but what if you want to create, lets say, 100 abilities. You will have to create each cooldown/active time for each and everyone, right? Is there a workaround for this issue?

    • @yowhatitlooklike
      @yowhatitlooklike Місяць тому

      If you are expecting cooldown/active time to be roughly the same for all or most abilities, you can set default values for those variables in the ability script. Or maybe another solution is to keep a static class holding the cooldown/activetime as different constants and have the SO pull the values from that when empty... that way you can group cooldowns into different "default" values instead of being stuck with just one

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

    Just straight up doesn't work for me. I'm doing a platformer so maybe that's why, but when I click the assigned key, it doesn't do anything, even when I turn the velocity up.

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

    Im trying to get this to work with Unity's new third person controller, but the dashability script doesnt seem to be referencing the script for Unitys movement... Any suggestions? also very nice video man im subbed

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

      I sadly can't help with that because I don't know anything about the third person controller. But I hope you find a solution! And thanks for the sub :D

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

    Would you expand it by putting more and more Ability holder on the player or using a list? If using a list, how would you do that? I tried it but it doesnt work for me

    • @shockingchris9809
      @shockingchris9809 5 місяців тому

      Not that it matters anymore, but if you wanted multiple buttons to work for multiple abilities, you could just add other abilities and have them keyed differently. Having the key check in the update is just for simplicity sake. The way I implement multiple abilities is that I can only really use one ability at a time so I just have a UI way to switch them out. Right clicking on a new spell or using a button to bring up a menu where you can click the one you want to use. It will make it so the ability you choose is in the ability variable and therefore uses its functions.

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

    Hey bro! I need soone who know After effects. Can you help?

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

    Do you like eat the blocks' channel by any chance? :D

  • @dibaterman
    @dibaterman Рік тому +1

    The downside to this system is you are going to make as many CS files as you have abilities... sort of. Any unique ability needs to have a new CS file while any similar abilities but with augments can just adopt those changes. So for instance a dash with y movement could just be setup through the movementInput.
    I like how simple this system is but it's a bit.

    • @oh-facts
      @oh-facts Рік тому +2

      For small games, sure it can be annoying to have these many scripts. But for something bigger, it's better to have separate scripts because what if you eventually decide to have effects unique to your dash? What if there's a very specific particle that is emitted, or some other shader effect made specifically for dashing? Maybe when you dash, you want to have some invincibility frames too. Having abilities decoupled from other systems would be much better for scalability.

  • @halivudestevez2
    @halivudestevez2 5 місяців тому

    While it's great for inspiration, I will rather analyze and design my requirements. The only thing I see reason for a SO is, that you can set it an Icon - visual representation. Otherwise I see a static class, or an xml for data seems better to me.
    Now thinking....

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

    Hey im getting the error cs1061 in the Dashability with the movement.movementInput part and cant find out what i shoulds do?

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

      You probably don't have a movementInput variable or you just typed it incorrectly. The error cs1061 appears when you try to access something like a function or variable that doesn't exist.

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

    what if you dont know how long the ability will last but you know the condition for when the ability is finished and cooldown can start?

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

      Tie it into the animation time if I’m understanding correctly. So instead of ability duration having a hard set amount of time, you could say if my animation is finished then the ability is finished now start cooldown. But if the animation is not finished wait to start cooldown until animation finished.

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

    Why won’t my unity highlight ScriptableObject as green? Basically when I type it in it does not reference anything

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

      Do you mean when you write ScriptableObject after the "Ability : "?
      Probably your Unity project files haven't loaded in correctly. If you are using VS Code, you may have to wait for a bit until your project name is shown in the bottom left corner in VS Code. Then the project files are loaded and VS Code can recognize what you are writing.
      But if you don't use VS Code or that doesn't work for you, I sadly don't know how to solve the problem.

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

    How would you modify AbilityHolder so it accommodates multiple abilities, in terms of holding the cds and whatnot?

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

      I would not modify the AbilityHolder but rather add multiple AbilityHolder Components on the same gameobject.
      But it would be possible to modify the script to manage multiple abilities. If you really want that, you could make a list of abilities, cooldowns and so on. And In the Update function you would have to loop through the hole list and manage all ability specific variables.

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

      @@timberdev that's what I ended up doing, thanks a lot for the reply :)

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

      @@ThePro-ng4yt That's right, you take the cooldowns/active time from the ScriptableObject and create an Ability[] array and put your ScriptableObjects in there.

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

      @@egekalay4318 I'm asking late, but could you please show me what the code looks like?

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

    If i wanna give my player multiple abilities, do I have to give him multiple AbilityHolder-Scripts or can I somehow combine it in one big AbilityHolder-Script?

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

      You can do either of them if you want to. But it would be simpler and also more clean if you add multiple ability holder scripts.

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

      @@timberdev thats the way i have done it Right now. One of my skills is shooting a Fire Ball. I am instantiating the Fire Ball throuh script like in your dash script. The Best way to handle its behaviour is through a second script attached to the fireball prefab, Right?

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

      @@Ordelos Yeah, a monobehaviour script on the fireball is probably the best solution.

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

    Im having issues where my script cant access the player movement script because of its protection level(error CS0122)

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

      The script can't access the whole player movement script? That's weird. Maybe you are trying to access a private variable in the script. Then you just have to make it public.

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

    Well this is a pain in the butt for a more complex movement system.

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

    Idk why but it doesnt disable the ability, my player keeps moving really fast...

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

    if you can skip GetComponent, then it'll be great tutorial, but currently you allow newcomers to learn some bad habits alongside with new practices of scriptable objects

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

      Yeah, it's certainly not the cleanest approach possible but It's not that easy to find a workaround for GetComponent. You could pass a component to the ability instead of just the gameObject. This would avoid the GetComponent part. But the tutorial is mainly about the basic scriptable object ability system. I'm unsure if it is the best way of implementing changable abilities. But for me this is the best way I found. If you have an idea to improve this, please let me know. I would love to learn more :D

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

      @@timberdev usually you know which classes will use abilities and what abilities can potentially use, so you can cache component in ability_user class and make GetComponent func or propety etc. Also, passing "this" instead of gameobject. So ability class can get it by asking user.GetComponent() or kinda like. Even if your abilities can be used by multiple classed, it's better them inherit from same AbilityUser class or IUseAbilities interface which contains functions/properties or kinda like. It's can go very complex, but for this lvl of tutorial it will be enough for AbilityUser script to have public cached component as B&B solution.

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

      @@timberdev overall you video was nice to watch with nice dynamic and good easy to understand &clean implementation

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

      @@nightyonetwothree Your absolutely right on that! Thanks for the heplful feedback :D

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

    What is the software are you using to typing script

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

      I use Visual Studio Code.

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

      @@timberdev i like your vs font color,can you export your setting for us?

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

    Provide project file in git please awesome tut bro

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

    i think you should explain more since for example i had no idea what the heck a enum is so it made the turorial impossible for me to understand.

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

      just search for it, bro. You have internet

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

    Its a great tutorial, but my movement is extremely laggy. Does anybody know how to fix it?

  • @tina-mg5qn
    @tina-mg5qn Рік тому

    └ good s

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

    can i get your theme to use in visual studio

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

      The theme is named "One Monokai".

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

      @@timberdev can i use it in visual studio?i didnt scripting in vs code,so if i can use the same theme in vs,it would be great

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

      @@redinternet9893 As far as I know visual studio has no option to change color themes.

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

      @@timberdev thx

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

    How do i expand it?

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

      Depends on what you want to expand. For example you could add more properties to your abilities or just create more abilities.