How To Create a Talent System in Unity | Skill Tree Tutorial Part 1 - The Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to this two-part tutorial series which was quite hard to say that you know I got that third time um in this tutorial series and again it's going to be two parts uh we're going to be building this system here so you know I've got a little cheat button here to give myself skill points and then we've got a set of skills here we've got tier one skills tier two skills and tier three skills um we can't buy the fox's cunning skill yet because our pre requisites aren't met and we need to get the Bulls strength skill before we can buy that one so if we come up here we can see this is Bulls strength I'm going to hit purchase on this one and you can see our skill points goes down and our strength goes up by 10% uh our strength was 10 so now 11 uh because it increased by 10% and we can actually now buy Fox's cunning which increases our intelligence by two points and this costs four skill points so we will purchase that and our intelligence has gone up to 12 and we can see this one owl's wisdom uh it increases wisdom by 20% and it also increases our intelligence by one point so we can actually increase multiple stats with one skill it's not like a one or the other type thing um and this also requires bull strength which we bought so we can buy owl's wisdom and finally you can see we've got some abilities as well so like double jump Dash teleport um so it's not just numerical stats we're increasing here we can also unlock abilities through our skill tree as well so if we come down here and these pictures I just found a pack they're not related to the abilities um that one kind of matched uh and I suppose that one matches but yeah there's no frog in this picture but this is the Frog leap skill which grants the double jump ability and we need to make sure we've got owl's wisdom that's the prere so uh that was that one which we have purchased so we've got frog leap grants the double jump ability and we'll purchase that and we can see the double jump is now unlocked so obviously there's no game play to this um this is just the talent system we're building and it's using the UI toolkit unity's new UI system so part one of this video is going to be the programming of making all of the logic that goes into into the skill system and then part two which will be a separate video is going to be using uh UI toolkit to build this simple UI with the buttons and the display our stats our actual skill buttons in this tree format if that sounds like something you're interested in then obviously stick around in this video and do the programming and make sure you subscribe to see the next video which is going to be all about the UI with that said let's just jump straight into the video okay so let's get started um I'm going to make a new project in the unity Hub and the editor version that I will be using is 2022 3.18 F1 and I'm just going to use the 2D core template to keep things nice and light and we can name this the skill tree tutorial and I'm going to go ahead and click create project okay so our blank Unity project is now set up here and there's no packages that we need to install because the UI toolkit especially with this version of unity just comes built in is uh right here with UI Builder but before we get into the actual UI of it I want to actually get the stats system um coded and like working because it's actually very simple um it's a really simple system and it's just got a few scripts uh and I think it gives you a lot to build off of if you want to make it more complicated um yeah as you saw in the demo at the start this system will let you increase like stats like strength or stamina or like whatever it is um as well as unlock specific abilities like a double jump or a Teleport or a dash and it's all the same system so the first thing I will do is I'm going to right click create and I'm going to create a folder and I'm going to call this underscore scripts the underscore is just so it's always at the top of the folder here and we'll go into here and I'm going to make another folder and I'm going to call this our uh skill system and we'll go in here and I'm going to create a new C script and I'm going to call this the player skill manager and I'll zoom in here so you can see my uh scripts nice and big so the first thing we want to do in the uh player skill manager is Define what our skills actually are so so for this game I'm going to say there's um kind of D and stats so there's strength dexterity intelligence wisdom Charisma Constitution um going say there's three abilities that the player can unlock called double jump Dash and teleport and we'll also want to keep track of skill points which is how we're going to uh purchase abilities on the tree so let's start this um so I'm going to make a private um int and we say here strength dexterity intelligence wisdom Charisma and Constitution and you'll see then this auto complete kicked in uh I am using GitHub co-pilot um it just really speeds up my workflow um just so you can see that again so I started to do um underscore we've got player skill manager and because it knows kind of what I've been working on recently it's just assuming that I want to to uh implement the stats from the demo project and actually that's what I really like about um co-pilot is as you work on a project it starts to learn um you know what your scripts can do what they are sort of capable of um some of the methods and functionality and it really really speeds up your workflow um for this tutorial I don't want to keep relying on so I am going to turn it um off I'm going to have to hit restart to restart the IDE so let's do that okay so copilot is uh disabled and I will Zoom back in here so we want our strength dexterity intelligence wisdom Charisma and and contitution so you see how much I'm struggling to type now um I'm just so used to it just knowing in my brain what exactly I want to write um we got private int and these are going to be our skills so we've got um double jump Dash and teleport so these are our like unlockable abilities these are our um stats and like I said we're going to want some skill points as well so private int skill points and these are all private we're going to want to have a way to kind of get the values out of them but we don't want to accidentally change them from outside of the script uh so we're going to use so we're we're going to use um public properties to get these so we can say public int strength and we can return underscore strength and you just need to do those for all of these private um stats up here so we've got strength dext intelligence wisdom Charisma Constitution um as well as skill points which we could put them put a bit of a gap between them to keep our code organized kind of into this um and then we also want to have some bulls that just say is double jump unlocked is Dash unlocked is teleport unlocked and we've defined this as an INT but we can actually return um in our public uh property uh a bull so we could say public bull um double jump and we can say that that's true if double jump the int is greater than zero so at some point we'll unlock a scale we'll up the int for double jump from 0 to one and then it'll be greater than zero so we know that double jump has been unlocked and we can do that for Dash and teleport as well and again so this is going to be very dependent on your game like not every game's going to have double jump Dash teleport um instead of strength decks intelligence wisdom blah blah blah you might have you know stamina uh hunger breath if you've got like a swimming mechanic like whatever your stats want to be then obviously you can replace these with your stats and again abilities like double jump or swimming or you know uh the Frisbee ability or the bow ability like whatever that is uh you can Define them here as ins but then return Bulls when that is in is greater than zero um and then we've got our skill points which um we want to get and we want to get these to show them in various places such as the UI but you might also want to get them in your um in other scripts like if you had a combat mono behavior on your player that would probably want to know what the strength is to modify some sort of damage from the weapon possibly um so yeah this is just a good way of being able to come back and get the and it's a safe way that you won't accidentally change them unless you mean to change them by unlocking an ability so underneath um skill points we can make a public Unity action and that's going to use the unity engine doevents namespace so make sure that's up here um and this is just going to be on skill points changed and we're going to call call this Unity action every time our skill points get updated and we can get rid of the start and update functions so obviously skill points is going to start at zero unless we um you know we could put serialized field here and then set starting skill points in the inspector um but you're going to want some sort method that you can call to gain a skill point whether that's like when you level up or if you pick up a skill point in the world like however your game wants to handle skill points there's going to have to be a method for gaining them so we'll do public void gain skill point and in here we'll just say skill points plus plus on skill points changed and then we can invoke that now for the other methods and some of the other variables we need to put um onto this we're going to need to make a new class and it's going to be a scriptable object called scriptable skill um I'm actually going to get rid of serialized field here and instead what I'm going to do is in the awake function I'm just going to set skill points uh equal to 10 for now and in fact we can set all of our um skills just to a default value of 10 and we'll give ourselves 10 skill points as well we're not setting um the double jump Dash or teleport we want them to be unlocked so they'll be zero okay so let's go back over to our Unity project and we can make a new script okay so in our scripts folder underneath our skill system I'm going to right click create ad and I'm going to choose Unity script and again this is a rider feature whatever your IDE is you just need to make a new um CS file C file but I'm going to click scriptable object and I'm going to name this uh scriptable skill and all that does is it just knows that it's to derive from scriptable object instead of mono behavior um and it fills in some of the kind of like bump for you like it just automatically create puts the create asset menu tag at the top um so I'm just going to say file name skill or new skill and for our menu name I'm going to say skill system Slash new scale and we're can have the order at zero that doesn't really matter um so we've got our scriptable object here which is a scriptable skill scriptable object um just to keep this you see it's also put it inside a namespace our player skill manager isn't inside a namespace so we should probably um do that so we can say namespace uncore scripts do skore system and that matches the folder structure that we've got here and if you don't know about namespaces I'd highly recommend going to uh just do a little bit of reading about them they're not complicated at all um but they're really handy to use um so we've got our scriptable skill here and this is going to need um another class to kind of work how we want it to work so here I'm going to say p outside of the curly braces of this public class scriptable object but inside the curly braces of our Nam space I'm going to say public class upgrade data and this is going to have a public int which is the skill increase amount so do we want to upgrade our um strength by 10 for example um and I also want a bull that public bull is percentage so we can with this flag this bull we can say the skill increase amount is either like a hardcoded 10 it's an increase of 10 or we can check that it's a percentage and if it is we can increase it by 10% um and just so we know what stat to actually upgrade so whether it's strength we're grading or intelligence wisdom whatever um we are going to need something called a public stat types stat type and obviously we've not defined what this is and this is going to be um a public enum so public enum uh stat types make sure I've spelled that correctly stat types and here I'm going to have stat types that just match what we've defined in our um skill manager so we've defined strength deck intelligence blah blah blah double jump Dash and teleport so we've got strength dexterity intelligence wisdom Charisma Constitution double jump Dash and teleport so now we can say this piece of information I will upgrade data we can say that it's um strength increase and it increases our strength by 10% if we want it to be a percentage or just increasing it by 10 in total um if that's how we want to go with that if we want to go that route okay so let's come back up to our scriptable skill scriptable object and here I'm going to have a public list of upgrade data and this is giving us an error and it's because we need to import uh systems. collections. generic so we need to make sure we're using that and I'm going to say public list of upgrade data called upgrade data you could also use an array if you want but I just like lists I find them easier to work with um so yeah we're going to call this upgrade data these are yellow because the um name and Convention is wrong it should be a capital u if it's public so I'm just going to fix that here just to stop getting those errors so we've got a public list of upgrad data um public Bull and this is going to be um is ability so is this like a double jump Dash teleport is it an ability as opposed to like a stat increase um then we going to have something to Define what the skill is so we'll want a public string um skill name um we can have a a text area and I'll just say uh one four and this is the amount of minimum and maximum lines that the text area has in the inspector and for this I'll say public string skill description we'll probably want a uh we'll need a Sprite for the kind of icon for the UI so we could say skill icon and then we can take in um a public list of scriptable I'm really struggling here scriptable skill and this is our um skill pre withits and I'm going to set this equal to new list of scriptable skills just so it's always um access we don't get any null reference errors and in fact I'll do the same up here I'll say a new list of upgrade data I also for this system I'm going to have a public int um skill tier and this will make more sense when we build the UI um but you saw how you know there uh tier one which is the top level skills and then the ones below that would be tier two and then tier three the like the ones below that uh so we can actually Define where in our skill tree a skill is spawned um so we can say public int skill tier and we also want a public int which is our cost so we've got public int cost um and this is how many skill points it takes to unlock this ability and we can actually generate our description um sort of procedurally um just to kind of make things easier for us but I also want to have a bull that just says uh um let's just overwrite description so if we want to tweak the sort of like automatically generated description we can check this ball and we can just type in something ourself we can completely override it if we want to put something different for a specific skill so underneath cost um to do these kind of um this automatic generation of our description I'm going to have a private void on validate in here I'm going to have some checks first so I want to say if our upgrade data list um if the count is equal to zero so if we haven't put any upgrade data um into our list then we just want to return because we want to generate the description based on what the upgrade um what upgrades this actually does so if it's um if this upgrades our strength and intelligence we want that to be reflected in the description but if we haven't actually put anything in here then there's no point there the description won't make any sense because there's nothing to describe because the skill doesn't currently do anything and likewise if overwrite description is true then we can just return as well um I also want to say if skill name is equal to nothing so if we haven't put one in yet we can just default the skill name equal to the name of this file so if we make the skill called you know like Bear's strength it will just put it will automatically populate our skill name but then we can change that if we want to call it something else without having to rename the file and then finally I'm going to make a new method called generate description and I'm putting this in its own method because it it's a little bit long um so you may as well try to keep on validate as clean as possible so we'll Implement that and that's just a void um method so in here we can check to see whether our um if our skill is an ability because if it's an ability uh we'll probably just want to say something like X grants the double jump ability like skill name grants the double jump ability but if it's not an ability and it in it can increase multiple stats well we can do that dynamically to say um this skill increases these stats by this much so first let's check if is ability and if it's an ability we're assuming that our upgrade data is only going to have one thing in it um you'll just have one piece of upgrade data and the stat type will be one of our ability stat types like double jump Dash or teleport so we can say if is ability we'll access that upgrade data um and we'll get the stat type from it and we can put here case stat types double jump and we'll say skill description is equal to and if we use the dollar sign before our string we can dynamically insert variables into the string so and they're done by curly brackets like this so we can say skill name grants the double jump ability and then you have to break and we'll do that for Dash and teleport as well it's the exact same thing to correct my capitalization on my copy paste so Dash grants the dash ability teleport grants the teleport ability um if it's not an ability so else then we're going to want to start building a string based on the um the things that we've defined so um we can actually use the string Builder just because it's a little bit more efficient and it's something that's good to know and that's in the system. text namespace so we need to make sure we're using system. text so we're going to make a new string Builder and I'm just going to call that SB and I set that equal to a new string Builder what this does is it allows us to keep appending um strings to our string Builder and then at the end we can convert that to we can just return um we can call this two string method and it's more memory efficient to do it this way instead of keep um combining strings by using the plug plus then just like adding them together um and the way we do that is we use the append method so we do SB um append and we're going to append the skill name increases and then we'll put a space at the end and then we want to Loop over all of our um upgrade data so we'll and we need to do a a for loop as opposed to four each because it matters the the index that we're currently at matters for how we build the string so we'll say for INT equals uh uh in I equals zero whilst I is less than upgrade data. count and make sure the brackets are correct and four not if sorry so 4 in I equals z and while I is less than upgrade data. count we can do i++ so here we're going to say um sb. append upgrade data at index I and we're going to get the stat type from it and we're going to call two string on this so if our stat type is strength this is going to start to read skill name increases strength if that is what our stat type is and then we can say um sb. append by oh so strength by S sp. append and then we could do up upgrade data I do skill increase amount dot two string and then we need to determine whether um this increase amount is a percent or like a set number of points so we can say s sp. append we can get our upgrade data I and we can say we we can check if it's a percentage if it is a percentage we will display the percent sign if it's not a percentage we can just say points and I'll put a space between uh before the word points and finally we want to see whether um the current index of this Loop is the last item in the array or in the list because if it is we'll want a full stop but if there's another thing in the list we'll want a comma because that's how punctuation works so we'll say is I less than upgrade data. count minus one because remember um lists and arrays Etc are zerob based so upgrade data. count minus one if it is we'll want a comma if it's not we'll want a full stop and then finally before we leave the else statement we can just say skill description is equal to SB do2 string okay so that is our skill um scriptable skill object let's go back into unity and just see what all of this generate description actually looks like so I'm going to go over to our tutorial in our skill system folder I'm going to create a new folder called skills and in here we can store all of our skills so if we right click create we'll now see skill system new skill at the top of our um rightclick menu and you know this is all blank the description is blank the skill name is blank um because we're still naming our ability here so if I use bear strength is the name you can see nothing happens and that is because um the name doesn't actually get filled in until we've got some upgrade data so we'll put that up to the top and also you'll notice that the upgrade data list didn't appear and that's because upgrade data we've not marked it is serializable so out just above public class upgrade data we have to do system do serializable like that now Ryder is showing us that these are serializable so we go back to Unity we've got bear strength and we've got our list here is empty currently obviously of um upgrade data and we've got our skill name matches the name of the file and we can change that to you know we could have like cows strength doesn't name the file it doesn't rename the file but if we wanted to change the file name to say like Bulls strength that will also not change the skill name because we um set in the code we'll only change it if the string is empty now if you want to if you always want the skill name to match whatever the file name's called all you got to do is get rid of the if statement we'll just say skill name equals name and then if we go back to our Skill Tree Project you can now see it has renamed itself to Bulls strength um we can set this back to Bears strength and skill name has been overwritten there so if we take a look at our upgrade data list and we expand that we can see our list is currently empty so bear strength currently doesn't do anything if we hit the plus we can then open up this and then we can see we've got step type skill increase amount and is percentage so Bear's strength is going to increase our strength so we'll leave that at strength and we're going to say this is going to increase It by Five Points if we wanted to we could also say that it increases our dexterity by 10% so you can see that we can have multiple um pieces of upgrade data to have a talent affect our skills in many ways it can affect one thing it can affect two three four like however many things you want and it can increase it in various ways as well um and you can see here that our description was automatically generated so we've got our skill name increases strength by Five Points comma dexterity by 10% if you wanted to be more like grammatically correct you could see you could check to see whether there's only 10 pieces uh sorry if there's only two pieces of upgrade data and if there is you'd put um instead of comma you'd probably and so increases strength by five points and dexterity by 10% and you could also see if the one that you're currently generating for if the index matches one before the last one um and that' say and as well that would probably again be more grammatically correct so we can have a quick look at doing that so here um instead of a comma or a full stop we can say if I is equal to upgrade data dot count M minus 2 so minus one is the last ele element in the the array minus 2 will be the second to last element in the array um so equals that we can say um sb. append and else we can decide whether we need to put a comma or a full stop so that should work yep so there we go we've got increases strength by five points and dexterity by 10% if we had a third one in um we can do intelligence by one point so now it says strength by Five Points comma dexterity by 10% and intelligence by one point well it says points and then s in Brackets we just need to get rid of that in the code there we go so that's how you can generate a description using string Builder um in quite a nice way I think and it just means you don't have to manually type in a description for every single one uh again we can't change that cuz it's in on validate but if we did want to um change this skill specifically we can say overwrite description and then you know start typing in if we uncheck that it will reset it back to the default that we've said um skill prerequisites obviously we need some other skills so here I'm going to um go right click create skill system new skill and we'll call this one owls wisdom so owls wisdom is going to increase our wisdom by 20% let's just say that so owl's wisdom increases wisdom by 20% and to unlock owl's wisdom you have to have already unlocked Bear's strength so we say Bear's strength there and because this has a prerequisite this feels like it should be a tier 2 skill um in the hierarchy of skills and there should be a scale a t one skill and we can say this one in costs one skill point and this one will cost three skill points so we'll build out a few more of these once we've got the UI up and running but that is how this skill system works currently of actually like defining what a skill is now we need to go back to our player skill manager and actually take in a skill and increase our stats in some way um so we start adding more functionality to our skill manager so for example we can have a check to see um so public bull can afford skill and this can now take in a scriptable skill which we will call skill and we could just return do we have enough skill points so we'll do underscore skill points is greater than or equal to skill. cost we will also want a um a way to unlock skills so we can say public void unlock skill this will take in a scriptable skill again called skill and we can use this caniford skill B um method so we say if we can't forward skill then just return um here you may want to like play a sound effect to something or do something else but for now we will just return and if we unlock the skill we want to minus the cost from our skill points so we'll just do skill points is minus equal to skill. cost and we will want to add all of our unlocked skills into a list because that way we can check through this list to see whether um prerequisites have been met so that prere that we put on our scriptable skill here we'll be checking a list of unlocked skills so all of the our unlocked skills does that match do I do our prerequisites exist in that list because if they do we've unlocked them so we can unlock that new skill and this is going to be a private list of scriptable skills called unlocked skills and this will be a new list scriptable skill and again this needs to be using systems. collections. generic at the top so here we can say unlocked skills. add and we can add our skill to it we will deduct the cost from our skill points and then we'll say on skill points changed and then we can invoke that so we can let our UI know for example that our skill points has been changed but this do actually mod modify our stats so how do we go about doing that so in our unlock skill function we're going to make a new function called modify stats so we'll say modify stats and that's going to take in um this skill here and I'm going to hit alt and enter in ryer to generate that so that's a private void modify stats taking in a scriptable skill called skill again our scriptable skill has this list of upgrade data so we need to Loop through all of our upgrade data and apply um apply it as and when it makes sense to do so um so what we can do is we'll just do a for each Loop so we'll say for each upgrade data data in skill. upgrade data we can just say is percent so bu is percent and we'll just store upgrade dot sorry uh we'll store data dot is percentage just so it's easier to refer to that instead of having to refer to data do is percentage um all the time and then we're going to make a switch statement based on the upgrade stat type so we'll say switch upgrade uh sorry switch data dot stat type so the first one we'll do is we can have um strength and I'm just going to put break in here just to get rid of the squiggly so the logic for doing this to keep this switch statement as clean as possible I want to make another function called modify stat and what this is going to do is it's going to take in as a reference the stat that we want to uh increase so we can say ref underscore strength so we're going to increase or modify our strength stat and then we can pass in our upgrade data as well and that's going to be modify stat which doesn't exist so I'll enter create method and this is going to be a private void modify stat and it's going to use reference int and this can just be stat it doesn't need to be called strength and then we've got our upgrade data here and this is going to be quite simple it's just going to check whether and actually I realized from the demo scene that I did we don't need this uh this is a hangover from away when I was doing this directly um this needs to be in the modify stat uh function and then we can just say if is percent then the stat so our stat is going to be increased by our stat multiplied by our data dot skill increase amount divided by 100f and we want to cast this whole equation to an INT so we need to cast that here so our stat is equal to our stat Times by our skill crease amount divided by 100 so let's just visualize that that so if our stat is 20 so our strength score is currently 20 and we want to raise this by 10% the way we're going to do that is we're going to times our stat so 20 by whatever skill crease amount is divided by 100 so if we've said um we want to increase it by 10% we'll do 10 * 100 is 0.1 so we're going to get our stat of 20 and times that by 0.1 so that gets us two so we're finding out here what 10% of 20 is and that's two and then we're going to increase our stat by two because it's um increased by our percentage here and if it's not a percent we can just say stat is plus equals our um data do skill increase amount so if it's not a percentage and we're increasing our strength by 10 we're just going to add it to our strength stat which is this reference here and again if you are confused by The Ref keyword um I'd advise doing just a little bit of research into the difference between reference values and value values um again I can link some stuff in the description below if you need to learn more about that so we just want to um do that for all of our um data types so I'm just going to copy them in just to save you watching me um do them so actually this is data now it's not upgrade so for example case wisdom modify our wisdom stat by um data and we're passing in um data and actually here instead of just doing them um like this we're going to do them in the exact same way so modify stat ref double jump data and this is the dash and this would be teleport because if we had to just have this even though it's very simple logic if we had to put that here it just get for each one it' just get really messy if we want to modify it in a different way in the future we can now just change this one sort of method we're not repeating code over and over again and actually if we want to we can make this even um simpler by just doing this so if is percent do this else do that really you don't even need this ball if you don't want we can just we could just copy that straight into here and this is a very simple method now but it just means we not have to copy and paste that over and over again and again like I said if you want to do anything else when you modify a stat we can just now do that in this one place so that's how to actually unlock the skill so we can modify the stats We'll add it to our unlocked skill um function we'll deduct our skill cost from skill points and then we can call our on skill points changed uh event and we can just have two more kind of like handy methods onto this now as well so we're going to have public bull um oh this needs to go outside this curly brace here so public bull is skill unlocked which takes in a scriptable skill called skill and this just returns where unlocked skills contains our skill and we can also have a public bull pre which again takes a a scriptable skill called skill and this is just going to return this here so return with that our skill doskill prerequisites count is equal to zero because if it is there aren't any prere so we can just say they've been met um or and this goes first because it will always evaluate this first and it won't need to check the or if this is true um so if this is false that we can then come then we can go to skill. skill prerequisites and we can say where all prerequisites exist in our unlocked skills um list so up here unlocked skills is this list here and this is a system. link function so we need to be using system. link for that to work we're basically just saying if all of the skills that our skill prerequisites if all of the skills in our skill prerequisites are contained within our unlocked skills um list then our PRX have been met there's one last script we need to make before we can move on to our UI and that is a skill Library so under our skill system I'm going to add another scriptable object so um add Unity script scriptable object and I'm going to call this the um scriptable scrip skill Library and here for file name I'm just going to do new skill library and for menu name we'll do skills Slash new skill library and this is just very simple it's just going to have a public list of scriptable skills and again we need to be using our system. collections. generic and we'll just call this our skill library and here we're going to want um just a function that returns a list of scriptable skills and here we can say get skills of tier and that will take in an INT called tier and for this we're just going to return and we're going to again use system. Link to uh use a handy function called where so here we're going to return our skill Library where and then we're going to say skill and then we're going to get our skill dot skill tier if that equals the tier that we've passed in here then we can return all of those as a list so skill Library where our skill it ask skills tier is equal to the tier that we're passing in so where all of those exist in our skill Library we're going to put them into their own separate list and return them so if we have five skills in our skill Library three of them a tier two and we call this method get skills of tier passing in tier two is going to get all of the skills from the skill Library where the skill tier is equal to two to and that is that Library that's not that big a script but it allows us to reference in one simple easy place all of the skills in our project so here we'll right click create skill oh I should have said skill system um ideally we want these to be under the same kind of like drop out thing so let's go to here so we've got um our scriptable skill is under skill system and our skill library was just under skills so let's just replace that with skill system in the scriptable skill Library we'll go back to Unity right click create skill system and let's make a new skill Library we'll just call this the skill library now this is quite a powerful um thing if you're game has characters with like different classes and each class has different skills then what you'd want to do is you could make like a a ranger skill library or a fighter skill library and then that's just a way to combine skills into one list and these are all of the skills that belong to the ranger or the Mage or like what ever it is for this system that like here we don't have different like in-game classes so we just need the one skill library and that just means we can reference the scriptable object in a range of different scripts and we can access its handy functions such as get skills of tier and also just query the library if we need to so I'm just going to add two scriptable skills to the skill Library we'll do bears strength and owls wisdom and again Bears strength is a skill tier one owl's wisdom is a skill tier two so with that kind of bit of the code done that's all of the actual skill system all of the functionality to make skills and unlock them and spend points is there but there's no game play sort of thing to back that up yet if we hit play obviously nothing happens so we need a way to actually manipulate these we um need some UI which is what we're going to do in the next video okay thanks for watching um so in the next episode we are going to be looking at building the UI system like I said here is an example in our demo project if you want the tutorial files for this project they are available now over on patreon uh which is patreon.com slos and you'll be able to download this demo project which is already complete with the UI stuff in you can get that uh right now over on patreon but for now thanks for watching subscribe to see the next video and I will see you guys in the next one bye
Info
Channel: Dan Pos
Views: 1,165
Rating: undefined out of 5
Keywords: unity tutorial, game dev, indie dev, game design, unity 3d, made with unity
Id: V4WrS-Wt2xU
Channel Id: undefined
Length: 59min 12sec (3552 seconds)
Published: Tue Mar 12 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.