Glad it was helpful! I'm not sure if I mentioned this in the video itself, but it's worth noting that data assets seemingly can't be directly stored in savegame objects (probably since they are considered assets) . so if you want to save data like that you'll have to make a struct or something with the same data that's in your data assets and make an array of those in your save object.
Useful video! That's 100% information that I need. Information about the existence and use cases of some features of UE. Sometimes I feel a lack of knowledge about the existence of some things and how to use them properly. Then I need a tutorial because I have no idea how to do something because I don't know about the existence and use of existing instruments. But with this type of content, I can avoid tutorial hell and solve my problems without tutorials. Perfect!
this is so awesome! Thank you for sharing. Do you think this will be best way to set Player status in the game like Driving/NotDriving? And i guess i can use this for changing interface Driving vs Walking as well?
Incredibly useful tutorial! I'm switching over from Unity and was looking to see if UE had something similar to ScriptableObjects. I have a question though.. At what point would it be too much logic to run in a Data Asset and i should instead be creating a blueprint (like parkour actions that directly effect player state?)
When its an object in the world that needs to interact witg the world, it should be an actor. Logic on a data asset should usualy be limited to manipulating the info on the asset itself, the moment you need to start casting, you probably are better off putting that code somewhere else. As a general guideline anyway
Thanks for sharing! I have a question. 3 weapons and 2 types of ammo How would I approach that with Data Assets? I'm currently holding the Ammo and AmmoType in the Game Instance since I want it persistent throughout the whole game. Is it a good idea to make a DA for AmmoType containing the Type and the Value? Or keeping it in the GameInstance is fine?
i dont think that you really need data assets with this for the most part. Possibly if you plan to have multiple kinds of ammo, it could make sense to make a data asset for all your ammo types but for the most part what I would recommend is just making blueprint classes for each weapon that share a general weapon class as parent. same with the ammo. keeping track of which weapon and ammo is currently in use you can do in the game instance if you want.
@@thegamedevcave I have a base weapon class that holds all weapons info, but I held the ammo and ammotype in the game instance since whenever I am switching weapons, the ammo zeros out.
I have a question. I am trying to get a SINGLE data asset, how would I go about doing that? It seems like the only way you can get a specific data asset is by using the get assets by path or by class, and then doing a for each loop, to see if its the specific asset you need. For example, I would like to add a specific weapon item, but to get the data asset, I would have to loop through all assets to find it. Is this a good method? I feel like using a data table will be more efficient as it can find a row by name? Whereas using assets, you loop through all of them and compare names till you find it.
Do you think having a data table of soft object references of data assets is a better approach to this problem? I could use the name row as an ID, and then when I find the particular asset I need, I can then get that row, the soft object reference, and load it into memory.
if you simply make a variable of the type of your data asset you should be able to give that a value, it's dropdown menu will only give you the options to choose from all of that type of data asset and nothing else. if you need to do this on runtime instead of just assigning a value in your blueprint a data table might be the easiest way to go yeah. Another method would be to put them all in an array somewhere and make a function to get them from the array based on an object reference input like I do in this video : ua-cam.com/video/MasCiM7Xba4/v-deo.html it's a pretty roundabout way of getting the data asset but it is probably still easier to work with that using the asset by path and certainly more performant then getting them by class. I'd probably go with your data table idea though.
yup data table with soft reference is what i'd go with probably! (if you do use the method from the other video I linked, also do use soft references instead of the hard references from that video of course)
Great video! Can I use a data asset to store my character data, like level, HP, MP, gold etc. I don't need to put my character data into Save & Load process, because that it changes the actual value in the character data asset?
no, you can't replace saving and loading savegames with this. the data you write to a data asset doesn't stick around between play sessions. you can do this to have the data persist between levels though, but it's not a great way of doing that either.
@@thegamedevcave Thanks for the replay. I just store the data in GameInstance as always. I feel like that Data Asset is a little bit like Scriptable Object in Unity
I believe it's not required to do that. For my event flag system made in blueprint I never explicitly load them in anywhere, and that works perfectly fine. That said, for my combat system I load them in ASynch on the fly and that has resulted in some issues so it still is best practice to look into this probably yeah.
@@ionalpha every so often when i try to load them in and use them right after, some parts of the asset seem like they're not yet loaded in. which makes sense, it's being done Asynch, so just assuming the loading is done like 3 lines of code down isn't a great thing to do... that's my bad... but that does end up with some thigns like a particle ssytem or a sound effect ends up refering to a nullptr and crashing the game. from testing it tends to only happen once every so often, seemingly more on lower end hardware (CPU). So making sure everything is loaded in before you start to sue thigns is very important. but that was all through c++, i am still pretty sure blueprint just kind of deals with that. but i'm not 100% confident there
@@ionalpha make sure you test it in a packaged game too. I didn’t run into it until other people had this issue because I do all my testing in the editor where the data assets seemingly are already loaded in
I have a question! Is this possible to put the table of attributes in the gameplay? Maybe as widgets? My idea is to bulid the level of database of mesh models, and thanks to table of content manipulate it.. For example hide all models from one type or show only models show only those models that meet certain characteristics
that sounds like a big project. it surely is possible, although, if the end user doesn't need to be able to add anything to that table, and it's only a database of all the items in the game with their respective info, using a datatable would be much better for that. Downside to dataTables though is that they're only for reading data, you can't programmatically add new data into them on runtime.
Thank you for that quick answer! I had a idea for a project conected to my studies.. Would you be interested in me describing it to you in an email? I have a few questions about it
Why not just create an actor BP and say it like BP_Sword and have all the variables in there? What is the true benefit of Data Assets vs Actors for items?
The main thing to remember is that data assets are just that, assets. they exist as files on disk, not objects inside a level. a data asset has more in common with a 3D mesh or a material than it does an actor. So yeah, for a swrod, espcially if you dont have a whole item system in yoru game, making it an actor makes more sense. But take or instance making an inventory system (something which I recently did a whole series on) The items in your inventory doesn't exist in the world, so you can't use actors to keep all that information, instead every item is a data asset with it's corropsonding values (what mesh it displays when it IS spawned into the world as an actor, what image it displays in the inventory, what value it has in a shop and so on)
@@thegamedevcave Hmmm but how is a data asset any different from a struct for inventory purposes? Currently I am building my own inventory system for my prototype game, and I just use a struct for items, and then include that struct in the inventory array and also as a variable in the Item actor. So when I spawn an item in the world, and pick it up, my functionality will take the details from the actor, store it in the inventory array in the item struct, then destroy the actor. If I want to drop the item I can just spawn the actor I want from the details in the inventory struct. I have searched a lot on different forums, but no-one can conclusively explain why Data Asset is preferred over Struct. Besides the obvious "in DA you can perform functions", is there any other benefit??
structs are still variables that you write onto another object that exists in memory, data assets (for all intents and purposes) are objects by themselves that exist on disk. if you have minecraft as exmaple : wooden sword has a certain durability, a certain attack damage , attack speed and all that. you would store those things in a data asset so that you can just easily reference that instead of having to indevidually worry about setting all those values anytime something happens to be a wooden sword. then stone sword has different values, iron/diamond and so on all have their own values. Now, do you really want to have to write all those seperate values to a struct every time you make or move an item? probably not, it's prone to making mistakes, and you're needlessly throwing oppertaions to read and write values on the cpu (i will admit, that's probably not going to be an actual problem but still, when it's not needed, you probably should avoid it). with a data asset, the data for that one item exists as a file on disk, so instead of copying over all those values every time, you just refernce that one asset that holds that data, all your wooden swords will look at the wooden sword data asset when they need to know something about their info. stone swords look at the stone sword asset, iron swords and that asset. This also means that if you want to change something about a value on one type of item, you simply change it in your data asset instead of having to dive into your code and find where you set all that stuff in the first place. if nothign else, it will help keep things organized once a game grows past only a handful of items, because going through and finding that in code will be an increasingly massive headache comapred to just a data asset (or even a data table, depending on the needs of the game)
@@thegamedevcave I see... thank you for the explanation. The downside of data assets is that you cant use it for data that changes. For example, a sword that loses durability, cant be changed in the data asset, else everyone with that sword will also have the changed durability. So if I understand it right, a data asset is best used for the common values of an object. So in this case, a sword, with its MAX durability, Base Damage, Weight etc, but all other values like current durability, quantity, upgrades etc are better stored in an array using struts?
So i have an issue, i am useing data assets for my skill system. but my data assets keep resetting to default every time i close unreal and open it again.
Data assets will do that, they are not save data. They will retain changes made on runtime during a session, but restarting the engine (or packaged game) sets them back to defaults
@@YourJudgement-ms7kv no, data assets aren’t save files, they will recent back to default when the game is closed and reopened. You can of course put the data in a savegame and update all your assets when you load said savefile:)
Thanks for showing examples of their use at the end. The Event tracking was an interesting use case I hadn't thought of. Very nice.
Glad it was helpful! I'm not sure if I mentioned this in the video itself, but it's worth noting that data assets seemingly can't be directly stored in savegame objects (probably since they are considered assets) . so if you want to save data like that you'll have to make a struct or something with the same data that's in your data assets and make an array of those in your save object.
Useful video! That's 100% information that I need. Information about the existence and use cases of some features of UE. Sometimes I feel a lack of knowledge about the existence of some things and how to use them properly. Then I need a tutorial because I have no idea how to do something because I don't know about the existence and use of existing instruments. But with this type of content, I can avoid tutorial hell and solve my problems without tutorials. Perfect!
Glad it was helpful!
You don't know what you don't know!
this is so awesome! Thank you for sharing.
Do you think this will be best way to set Player status in the game like Driving/NotDriving? And i guess i can use this for changing interface Driving vs Walking as well?
Hm probably not, you are better off just making that a variable on your player and setting/getting it with a blueprint interface
3:44 damn had a whole skill component in my mind xD
Incredibly useful tutorial! I'm switching over from Unity and was looking to see if UE had something similar to ScriptableObjects.
I have a question though..
At what point would it be too much logic to run in a Data Asset and i should instead be creating a blueprint (like parkour actions that directly effect player state?)
When its an object in the world that needs to interact witg the world, it should be an actor.
Logic on a data asset should usualy be limited to manipulating the info on the asset itself, the moment you need to start casting, you probably are better off putting that code somewhere else. As a general guideline anyway
Thanks for sharing!
I have a question.
3 weapons and 2 types of ammo
How would I approach that with Data Assets? I'm currently holding the Ammo and AmmoType in the Game Instance since I want it persistent throughout the whole game.
Is it a good idea to make a DA for AmmoType containing the Type and the Value? Or keeping it in the GameInstance is fine?
i dont think that you really need data assets with this for the most part. Possibly if you plan to have multiple kinds of ammo, it could make sense to make a data asset for all your ammo types but for the most part what I would recommend is just making blueprint classes for each weapon that share a general weapon class as parent. same with the ammo. keeping track of which weapon and ammo is currently in use you can do in the game instance if you want.
@@thegamedevcave I have a base weapon class that holds all weapons info, but I held the ammo and ammotype in the game instance since whenever I am switching weapons, the ammo zeros out.
When i right click on content browser my input tab doesnt show please help, i cant move forward without it
Assat...
I have a question. I am trying to get a SINGLE data asset, how would I go about doing that? It seems like the only way you can get a specific data asset is by using the get assets by path or by class, and then doing a for each loop, to see if its the specific asset you need.
For example, I would like to add a specific weapon item, but to get the data asset, I would have to loop through all assets to find it. Is this a good method? I feel like using a data table will be more efficient as it can find a row by name? Whereas using assets, you loop through all of them and compare names till you find it.
Do you think having a data table of soft object references of data assets is a better approach to this problem? I could use the name row as an ID, and then when I find the particular asset I need, I can then get that row, the soft object reference, and load it into memory.
if you simply make a variable of the type of your data asset you should be able to give that a value, it's dropdown menu will only give you the options to choose from all of that type of data asset and nothing else. if you need to do this on runtime instead of just assigning a value in your blueprint a data table might be the easiest way to go yeah.
Another method would be to put them all in an array somewhere and make a function to get them from the array based on an object reference input like I do in this video : ua-cam.com/video/MasCiM7Xba4/v-deo.html
it's a pretty roundabout way of getting the data asset but it is probably still easier to work with that using the asset by path and certainly more performant then getting them by class. I'd probably go with your data table idea though.
yup data table with soft reference is what i'd go with probably! (if you do use the method from the other video I linked, also do use soft references instead of the hard references from that video of course)
Great video! Can I use a data asset to store my character data, like level, HP, MP, gold etc. I don't need to put my character data into Save & Load process, because that it changes the actual value in the character data asset?
no, you can't replace saving and loading savegames with this. the data you write to a data asset doesn't stick around between play sessions. you can do this to have the data persist between levels though, but it's not a great way of doing that either.
@@thegamedevcave Thanks for the replay. I just store the data in GameInstance as always. I feel like that Data Asset is a little bit like Scriptable Object in Unity
@@WeirdGoat Data assets pretty much are unreal's version of scriptable objects indeed!
you did not explain how and where to load these primary data assets. you have to load them manually using asset manager.
I believe it's not required to do that. For my event flag system made in blueprint I never explicitly load them in anywhere, and that works perfectly fine.
That said, for my combat system I load them in ASynch on the fly and that has resulted in some issues so it still is best practice to look into this probably yeah.
@@ionalpha every so often when i try to load them in and use them right after, some parts of the asset seem like they're not yet loaded in. which makes sense, it's being done Asynch, so just assuming the loading is done like 3 lines of code down isn't a great thing to do... that's my bad...
but that does end up with some thigns like a particle ssytem or a sound effect ends up refering to a nullptr and crashing the game. from testing it tends to only happen once every so often, seemingly more on lower end hardware (CPU). So making sure everything is loaded in before you start to sue thigns is very important. but that was all through c++, i am still pretty sure blueprint just kind of deals with that. but i'm not 100% confident there
@@ionalpha make sure you test it in a packaged game too. I didn’t run into it until other people had this issue because I do all my testing in the editor where the data assets seemingly are already loaded in
I have a question! Is this possible to put the table of attributes in the gameplay? Maybe as widgets? My idea is to bulid the level of database of mesh models, and thanks to table of content manipulate it.. For example hide all models from one type or show only models show only those models that meet certain characteristics
that sounds like a big project. it surely is possible, although, if the end user doesn't need to be able to add anything to that table, and it's only a database of all the items in the game with their respective info, using a datatable would be much better for that. Downside to dataTables though is that they're only for reading data, you can't programmatically add new data into them on runtime.
Thank you for that quick answer! I had a idea for a project conected to my studies.. Would you be interested in me describing it to you in an email? I have a few questions about it
Day-ta Ass-At!
interesting, this is a more streamlined version of using objects instead of structs
pretty much, that's a good way to see it!
Why not just create an actor BP and say it like BP_Sword and have all the variables in there? What is the true benefit of Data Assets vs Actors for items?
The main thing to remember is that data assets are just that, assets. they exist as files on disk, not objects inside a level. a data asset has more in common with a 3D mesh or a material than it does an actor. So yeah, for a swrod, espcially if you dont have a whole item system in yoru game, making it an actor makes more sense.
But take or instance making an inventory system (something which I recently did a whole series on) The items in your inventory doesn't exist in the world, so you can't use actors to keep all that information, instead every item is a data asset with it's corropsonding values (what mesh it displays when it IS spawned into the world as an actor, what image it displays in the inventory, what value it has in a shop and so on)
@@thegamedevcave Hmmm but how is a data asset any different from a struct for inventory purposes? Currently I am building my own inventory system for my prototype game, and I just use a struct for items, and then include that struct in the inventory array and also as a variable in the Item actor. So when I spawn an item in the world, and pick it up, my functionality will take the details from the actor, store it in the inventory array in the item struct, then destroy the actor. If I want to drop the item I can just spawn the actor I want from the details in the inventory struct.
I have searched a lot on different forums, but no-one can conclusively explain why Data Asset is preferred over Struct. Besides the obvious "in DA you can perform functions", is there any other benefit??
structs are still variables that you write onto another object that exists in memory, data assets (for all intents and purposes) are objects by themselves that exist on disk.
if you have minecraft as exmaple :
wooden sword has a certain durability, a certain attack damage , attack speed and all that. you would store those things in a data asset so that you can just easily reference that instead of having to indevidually worry about setting all those values anytime something happens to be a wooden sword.
then stone sword has different values, iron/diamond and so on all have their own values.
Now, do you really want to have to write all those seperate values to a struct every time you make or move an item? probably not, it's prone to making mistakes, and you're needlessly throwing oppertaions to read and write values on the cpu (i will admit, that's probably not going to be an actual problem but still, when it's not needed, you probably should avoid it).
with a data asset, the data for that one item exists as a file on disk, so instead of copying over all those values every time, you just refernce that one asset that holds that data, all your wooden swords will look at the wooden sword data asset when they need to know something about their info. stone swords look at the stone sword asset, iron swords and that asset.
This also means that if you want to change something about a value on one type of item, you simply change it in your data asset instead of having to dive into your code and find where you set all that stuff in the first place. if nothign else, it will help keep things organized once a game grows past only a handful of items, because going through and finding that in code will be an increasingly massive headache comapred to just a data asset (or even a data table, depending on the needs of the game)
@@thegamedevcave I see... thank you for the explanation. The downside of data assets is that you cant use it for data that changes. For example, a sword that loses durability, cant be changed in the data asset, else everyone with that sword will also have the changed durability. So if I understand it right, a data asset is best used for the common values of an object. So in this case, a sword, with its MAX durability, Base Damage, Weight etc, but all other values like current durability, quantity, upgrades etc are better stored in an array using struts?
@@bighit20100 yup that’s pretty much correct!
So i have an issue, i am useing data assets for my skill system. but my data assets keep resetting to default every time i close unreal and open it again.
Data assets will do that, they are not save data. They will retain changes made on runtime during a session, but restarting the engine (or packaged game) sets them back to defaults
@@thegamedevcave Can we set a save function in the data assets so they don't default again? Also thanks for the video! Very Helpful!
@@YourJudgement-ms7kv no, data assets aren’t save files, they will recent back to default when the game is closed and reopened.
You can of course put the data in a savegame and update all your assets when you load said savefile:)