How To Set Up The Asset Manager In Unreal Engine (Part 1) #UE5 #CPP #Tutorial #GameDev

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yo what is good guys it's your boy kane yes sir i'm back with another video so i don't know if you guys can see this but i'm working on a tutorial series here i'm redoing the uh the infamous steam uh multiplayer tutorial series but i'm doing it completely in c plus and i'm adding a twist to it i'm going to show you guys how to use the asset manager so that we can make things data driven uh in the old series they have a character selection screen and they go in and they manually set up all the buttons for the characters but in a game where you're going to be online and you're going to be adding new characters over time you don't want to have to keep manually going back and adding those characters every time so what we're going to do is set up the foundation for a data driven character selection screen and that's going to be my main point of this series uh even though i will be showing you how to like basically do all the things that they did in that series in c plus my main focus is showing you guys the asset manager and how strong it really is so the first thing we want to do is definitely be inside of an ide whether that's visual studio or you know ryder you dig what i'm saying go ahead ryder get your boy get your boy a sponsorship baby i need it talk to your boy uh so we're gonna come over here and wherever you want to have this set up at i usually put things like this like singleton stuff inside of a core folder and uh don't worry about the organization this project this is just if you're already working on a project and you want to learn how to set up the asset manager this is for you but i will be redoing this as a as a whole from scratch where we'll set it all up to where everything makes sense but just pay attention if you want to get this set up in your project so we're going to go add we're going to add it unreal class it's going to be from you object and we're going to go ahead and call this for me i'm going to call it my steam uh this is my steam asset manager so i'm gonna do that it's gonna set up the class for me with the uh the baseline code for me i'm gonna extend this from you asset manager and go ahead press enter there and it didn't include the header for some reason so i'm alt enter and include the definition for the asset manager the first thing we want to do is come in here and create a constructor it's going to be an empty constructor but we we we need it just in case you know what i mean so use steam manager and we're just going to give it a uh open and close curly brace so that it's empty and we also need this type called uh it's a struct it's a f primary asset type right here f primary asset type now if you go ahead and click into this it says a primary asset type represented as an f name internally and implicit implicitly convertible back and forth this exists so the blueprint api can understand it's not a normal ff name so basically what this asset type is is a way to communicate in between the asset manager and the ui or inventory systems what type of asset this particular asset that we will be using is uh for this particular case it's going to be something that is very uh like a static to our character selection screen so this is going to be a static const and the reason we're going to use static constants because we're only going to set this one time it's never going to change no matter what throughout the project so static cons left primary asset type and i'm gonna call this my character item type and like i said i'm making a a data driven character selection screen meaning that say you have a game with four characters starting out and then maybe like three months down the line you add two more characters you would just add those character asset types and then the the ui the character selection screen will automatically update with the information because we don't like to manually do things like in the in the old series they have the buttons manually set up and you got to go in and set up all eight buttons for all eight characters and that could be real tedious for like a game like smite that has damn near 150 characters i don't know how many characters they got but they got a ton of characters in that game well yeah a game with a lot of characters you don't want to have to manually go in and set that stuff up it's prone to human error so we're we're going to do this very uh dynamically so yeah we need this this f primary asset type just to just to let everybody know hey this is what we're doing with this we also need to go ahead and make this function here this virtual void uh it's an override virtual void start initial loading and this is so that we can use a global uh system it'll globally load all of our data assets for us i think you can also go into this and like do custom code but i haven't gotten that deep into it all right another function that we want to do is a function that we're going to use in other classes just to get the asset type if we ever just to get the asset manager if we ever need it so this is going to return let me put an actual comment here this is going to return the asset manager singleton class and this is going to be a static it's going to return a new steam asset manager reference and we're going to call it get so that means we'll be able to say use steam asset manager colon call in get and then it'll run this function here uh so yeah we got that and that's pretty much all we need right here so i am going to alt insert and insert the definitions for these here and you know when it's an override it's a beautiful thing to have rider when there's an override it automatically does a super for you you can't beat this man nobody stands a chance okay so um we're just gonna run that super uh uh i'm looking at my other project right now and what this is for is that it it loads the ability system globals for us and that's like gameplay cues and stuff like that but we won't be getting into that that's that's a whole nother ball game baby okay so a few c sharp play people are around here looking at this you you've probably seen this kind of uh this kind of code before it's very similar to a singleton so we're gonna go u steam asset manager pointer and we're gonna call it this and we're going to set it equal to a cast using the u steam asset manager as the object that we want to cast to and we're going to cast from the engines asset manager so because when we set our asset manager in the engine file i'll show you how to do that as well this will populate here and we can cast and make sure that it's of the type that we set here so i i i've always seen somewhere that people find casting confusing and uh i understand uh i won't try to explain casting in this video but it's like saying this is that this is that baby that's it don't overthink it uh so if this we want to return a d reference pointer to this all right because we are returning a reference here we want to pass this by reference we want we don't want to um this is memory management thing uh i i gotta learn a little bit more about this type of stuff i won't even try to explain it but we want to de-reference the pointer to this so that it's a reference [Music] and then else we want to log out something we want to ue log say that we haven't set up the uh basically saying that we haven't and i got my own custom log here log steam uh mp and it's going to ask me to declare this in the header so let me get let me just do that to declare the header then i want to do this uh log steam mp i'll show you guys how to set up a custom login tutorial series as well uh so you can have your own custom logs and that'll print to a print to a a text file that you can read and debug that way so we want a log stream we want to say this is fatal this is a bad bad thing if we don't have this set up it's a bad thing so fatal and then we want to go ahead and tell that we have an invalid asset manager let me do this camel case and in the place that we set up the asset manager so it's the default engine dot ini file and we must set this to the steam asset manager so you see here this default engine ini file we're going to open that up in a second after we finish with this code here then i want to return a uh dereference pointer to the new object and we're going to just create the asset manager but it should never really get to this point so i don't even know why they make us type this code but i guess it's just here as a safety measure you steam asset manager and do that so now we're returning that all at all um places that we can return at and i won't try let me try to compile see if we run into any errors i don't know what i was working on before i start this video okay yeah we're good um so now that we got this asset manager set up this is pretty much all the code that you have to write for the asset manager uh most things just get repetitive there are some other functions that you can create uh but that's like i said those are more in-depth things that uh it's like particular to what game you're making so let me minimize this and then we want to go to the config i want to go to that default engine ini file and in this script engine dot engine we need to put that we're going to be using our asset manager so the way that we would do this is that we'll go here and i'm gonna just put it on the top and it's a it's a value called asset let me make sure i get this right it's asset manager class name so asset manager class name and we set it equal to a script in our directory here and it's inside of our project file which i what is the name of my project i believe it's uh steam multiplayer i think it's steam mp i got it i got a double oh steam ue5 okay so steam ue5 it's the name of your project whatever the name of your project is and then you put a dot and we give it the name of the class that we call our asset manager so mine is steam ue5.steam asset manager and with this typed in you are now using your custom asset manager so if i go here and build get a successful build uh if i go and open up the project here now i haven't created any data assets i'm saving that stuff for the tutorial series if you want to you really want to you know learn more about this asset manager and how to use it in your project i say subscribe and around like i said thanksgiving break when i start recording the videos and getting them out there uh we'll we'll get into depth about um how the data assets and hashtag manager all work together so we got asset manager here and uh like i said we've already set up our asset manager to be our own custom asset manager uh i won't even go into depth on this but say we had a say we had a type that we want to add our character type uh this is directories to exclude sorry so primary types to scan we would go ahead and add and we would say this is our character which we didn't do that reminds me of something character and the asset based class if we drop this down it'll bring up all of the classes that we have in our project but uh we we haven't set up a data asset so whenever we set up the data we'll be able to select that data asset and that's the base class of this uh primary asset type but since i just recognized that we need to put that character thing in here i'm actually delete this because i'm not going to be setting that up right now and i'm going to go back to my rider file and i need to go back to my asset manager and in the cpp file we actually need to come up here to the top and we need to but i don't even know how this compiled without that makes no sense uh usually when you do stuff like that it doesn't compile but we need to set up the f name for the uh for the asset type so the asset type that we created let me move this here and let me get rid of this the asset type that we created right here the primary asset type we need to actually give it a a value which we haven't done so f primary asset type and uh we're gonna like i said static in this const so you this is kind of like the syntax for that so you go use steam manager colon colon and it is the character item type you see it pulls it up for us and we want to set it equal to a text value and we're just going to call it character and this value i'm not going to compile that this value will match up with the value that we put inside of this primary asset type field here so we'll type character and it'll know it'll like line line itself up so yeah uh that's pretty much all i want to show you guys in this video if you're interested in more stuff like this man definitely subscribe to my channel leave a like on this video leave some comments tell me you hate me tell me you let me i need to hear it all baby you dig what i'm saying i'm out of here i'll see you guys in the next one peace
Info
Channel: Dev Gods
Views: 395
Rating: undefined out of 5
Keywords: blender, rigify, houdini, c4d, maya, rigging, animation, game development, 3ds max, character rigging, first person, first person animation, weapons, fps, shooter, moba, dreads, unreal engine 4, UE4, UE5, Auto rig pro, CC3, Character Creator, ryzen 3950x, rtx 3060, rtx 3070, rtx 3080, rtx 3090, Enhanced Input, Playstation 5, Xbox, Windows, Lumen, Nanite, Epic Games, bitcoin, nft, stocks, money, investments, programming, recoil, gun laws, Shootings, Unity, Mobile games, android, ios, Asset Manager, Data
Id: mRNo2S5pzYE
Channel Id: undefined
Length: 15min 43sec (943 seconds)
Published: Sun Oct 31 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.