Unreal Engine 5 Tutorial - Data Assets

Sdílet
Vložit
  • čas přidán 26. 02. 2023
  • Learn about Data Assets. What they are and how they can be used in a project.
    SUPPORT ME
    Patreon I / ryanlaley
    Buy Me a Coffee I buymeacoffee.com/RyanLaley
    Donations I paypal.me/ryanlaley
    PRIVATE 1-2-1 SESSIONS
    Email me at support@ryanlaley.com for more information and rates, or visit www.ryanlaley.com/sessions
    JOIN THE COMMUNITY
    Discord I / discord
    FOLLOW ME
    Twitter I / ryanlaley
    Facebook I / ryanlaleygames
    Instagram I / ryanlaleygames

Komentáře • 69

  • @dreamingacacia
    @dreamingacacia Před 11 měsíci +16

    Come back after 5 months and watch this again. I finally see good use cases and the performance doesn't seem to be much of a problem. Rather it might be even better than using data table both performance and efficiency.

  • @t3hpwninat0r
    @t3hpwninat0r Před 10 dny

    a lot of people asking why use data assets when we have data tables?
    - data table has all your structs as rows in 1 file
    - data asset is like a struct but it's an object and it inherits from a primary data asset class and each data asset is an individual file
    two main benefits of having each "row" as a separate file:
    1. version control when working in a team is much easier because you get merge conflicts when two people edit the same file at the same time. looking at different versions of the file in editor is also much nicer with data assets because you see the interface like class defaults of that data asset rather than a plain text notepad of your entire data table.
    2. after the game is cooked and distributed, you can always add more files but you can't insert more rows. data assets makes DLC and mods super easy, you just add the file or take it away.

  • @murnoth
    @murnoth Před rokem +4

    Thank you for all the work you do making these videos, It's all been really helpful for me learning this stuff the past 16 months

  • @TrojanLube69
    @TrojanLube69 Před rokem +10

    So unique they made possible to use data assets in blueprints. The c++ was very useful and more practical than data table specially when working with someone else, it reads and writes faster, or to preserve data with less probability of data loss for example when creating a new map variable or modifying structures, enums, etc inside a datatable.

  • @ABCBCACB
    @ABCBCACB Před měsícem

    Thanks for the great tutorial! It was straightforward and the examples were perfect to understand.

  • @TOMAvatars
    @TOMAvatars Před 6 měsíci

    Super cool to know this, very clear! Thank you!

  • @johnrex7108
    @johnrex7108 Před 28 dny

    Excellent video, man. Greatly appreciate you making them.

  • @TSA_CoRe
    @TSA_CoRe Před měsícem

    Thank you so much, This was I was looking for and you nailed it (again) :-)

  • @RolyPolyGames
    @RolyPolyGames Před rokem +4

    7:30 is so useful.
    I was using an awful c++ #ifineditor code that you have to comment out / get rid of before this to pull data asset info to set it on model during pre-construct etc.
    Edit: 8:30 I am screaming I spent so long looking for stuff like this. Originally I was doing it as a TArray instead of a TMap and realizing the woes it caused without an ID to verify it. Not to mention with item lists you want them hashed instead of arrays. This video is seriously gold. There is so little on Data Assets I had to gut my way through it blind for the most part.

  • @AUweaverzone
    @AUweaverzone Před rokem +3

    I was just reading documentation on Data Assets and thinking about how to apply them to my inventory system today, what a coincidence!

  • @kimochisaiko6442
    @kimochisaiko6442 Před rokem +1

    Excellent video

  • @user-nq8pu9cp1u
    @user-nq8pu9cp1u Před 5 měsíci

    thank you for explaining

  • @marcthenarc868
    @marcthenarc868 Před 4 měsíci +1

    Slight mistake at 1:27: FindRow doesn't iterate the table. The table's container is a TMap of row structures so the find function returns as quickly as any other TMaps. That's why you have a mandatory Row Name at the beginning of your row: it's the row's key.

  • @justinwhite2725
    @justinwhite2725 Před 5 měsíci

    Thank you. Coming over from unity and was looking to see if there was a feature that works like Scriptable Objects.
    When you said that you can add functions i was sold.

  • @sahildali7707
    @sahildali7707 Před měsícem

    Thank You.

  • @space_mex_og1795
    @space_mex_og1795 Před rokem +1

    How would you implement this into a ui inventory?

  • @ReOp14
    @ReOp14 Před rokem +8

    I stopped using Data Assets because of the bugs (5.1). One bug was that if you change a struct, all structs within the struct and the struct itself will reset all it's values. The other bug was that the data asset would reset all it's values EVERY TIME you restart the engine. I found that this happened only if you had very complicated structs in your data asset. I heard a rumor that it's because of enums being in a struct but im not sure about that.
    As a replacement I made my own data asset by just making a child class of an object.

    • @lospe85
      @lospe85 Před 10 měsíci

      Assuming you are using Objects for an inventory system. Do you know how to make sure that the object is destroyed after using it? For example, lets say you have your OBJ_ItemMaster with basic item info, then you have a OBJ_Weapon as child with exta variables (lets say Current and max ammo, fire rate, etc). You discard the weapon from your inventory and it needs to be destroyed. It is not enough to remove you object from the array (player inventory), because it would still be in memory. I have read that in order for an object to be grabbed by the garbage collector it needs to be properly nulled it out, this is clearing all references to it. But how to make sure removing it from the array is enough? rephrasing: how are you deleting/destroying this object instances when they are no longer needed?

    • @ReOp14
      @ReOp14 Před 10 měsíci

      @@lospe85 I haven't thought of how the garbage collector would work in this case. I thought the weapon object would be garbage collected if there is no more references to it (including if the struct or object containing the reference is destroyed), and if all references to the OBJ_ItemMaster are gone, I.E. deleted from the character's inventory, then it would be garbage collected. Do you have a way in the editor to check if something has been garbage collected or not?

  • @doomstarrobo7807
    @doomstarrobo7807 Před 11 měsíci +3

    I've been using Structs and Arrays, but this looks a bit better.

  • @pHaace
    @pHaace Před 10 měsíci

    So what if i want to use these for a skill system maybe? cause idk how best to do a rpg skill system and tutorials are hard to find for such a use

  • @soniclee1764
    @soniclee1764 Před rokem

    im using a data asset for settings for the player works fine in editor but when i package the build it wont save or load the data can you please help!

  • @carlosrivadulla8903
    @carlosrivadulla8903 Před rokem

    it's a good practice to place functions in ur data assets instead of creating interfaces?

  • @allanph2416
    @allanph2416 Před rokem

    Does it work the same way in UE 4.27?

  • @FedericoMarta17
    @FedericoMarta17 Před rokem

    How can I read the property of this ? it gives me an error when I try to insert it in the item it cannot find the reference

  • @ChrisWaitt-uq3xi
    @ChrisWaitt-uq3xi Před 3 měsíci

    Thanks for the great tutorial! I'm trying to setup multiple spawners for each item and in SpawnActor there I can't find a way to specify the data asset for that actor. is this possible? thanks

  • @Frappudazzu
    @Frappudazzu Před měsícem

    Great tutorial, is it possible to add variants on the same data asset? For example : flowers with different colour or shapes

  • @IIStaffyII
    @IIStaffyII Před rokem +7

    Hey great video man.
    DataAssets are NOT read only.
    I usually private my variables and make a get function. In order to avoid it being accidentally overwritten.

    • @bartasus194
      @bartasus194 Před rokem

      But they were meant to be read only. You can change values on them, but you should reconcider if you don't want to use another data type

    • @SuWoopSparrow
      @SuWoopSparrow Před 3 měsíci

      @@bartasus194 What data type would that be? Data tables are read only, what would I use if I want to make a database of things while being able to change their values through editor scripting/logic?

    • @bartasus194
      @bartasus194 Před 3 měsíci +1

      @@SuWoopSparrow You should use UObjects then. And probably have some kind of manager to store them.
      UObjects are meant to be instanciated and changed

  • @GhostRat__
    @GhostRat__ Před 4 měsíci

    Me 5mo I'll never use data or struct.
    Why are you setting that individually separate from a struct labled level variables?

  • @aufgespielt3768
    @aufgespielt3768 Před 11 měsíci +1

    But what is the advantage about a regular Actor Blueprint (parent and child) to use it as an Item? In a Blueprint i also saw a Mesh preview by the Way. Thanks Ryan.

    • @yonjuunininjin
      @yonjuunininjin Před 11 měsíci +1

      They are cheaper, you don't want to create a whole Actor (with a bunch of other variables that will be loaded into memory) just to hold some data.

  • @JoshLathamTutorials
    @JoshLathamTutorials Před 6 měsíci

    How would you have them selected randomly? That's the main reason why i'm using data tables.

  • @ZaynNaz
    @ZaynNaz Před rokem +1

    Good video, if you’re making a large game with a lot of items or things of that nature is it still good to use data assets?

    • @jamesgtmoore
      @jamesgtmoore Před rokem +3

      No , for large numbers of items, a data table is much better but what I do is at the Init event, in the Game Instance, I copy all data tables to their own array because data tables are read only. Arrays are not. Then I use the arrays in my various blueprints. You can also export data tables to CSV file format, edit them in a spreadsheet program and import them back into the data table again.

    • @soldieroscar
      @soldieroscar Před rokem

      @@jamesgtmoore how do export to csv file format?

    • @jamesgtmoore
      @jamesgtmoore Před rokem +1

      @@soldieroscar datatables can be exported using the right-click menu

  • @anaboliczyakrobata1909
    @anaboliczyakrobata1909 Před 10 měsíci

    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

    • @ethanwasme4307
      @ethanwasme4307 Před 9 měsíci

      you may potentially want to use gameplay tags for things like this so you can have multiple keywords you can toggle with a UI checkbox or such,,,
      i'm a noob but you can maybe loop through all the array elements and if something has the tags for "Building, Destroyed" then show them in the umg grid or whatever container you use

    • @t3hpwninat0r
      @t3hpwninat0r Před 10 dny

      @@ethanwasme4307 this is a good idea but you also need to decide if the tags are on the data asset (designed to be read only) or on the actor (designed to be set per actor and possible change at run time) or both (load it from the data asset into the actor to use like a default value and then change it at run time).

  • @kelvinmartinezfontanez5705
    @kelvinmartinezfontanez5705 Před 5 měsíci

    I just use a data table to randomize loot in chests, using this data asset method, is there a way to do the same?

    • @zablade
      @zablade Před 5 měsíci

      Idk if you found a way to do this in your project yet, but I'd have the chest run a function that randomly select data assets to spawn inside the chest when you interact with it.
      For example, you could randomize the amount of loot that spawns in a chest first, then use a for loop to randomize the data asset spawns that many times. Implementation is entirely a design choice, but relatively the same.

  • @meanderingdev
    @meanderingdev Před 4 měsíci

    When you use a data asset does that create a reference? Because one of the reasons in my data-driven stuff I use data tables is that you're just passing a name around rather than having to hard reference an asset.

    • @t3hpwninat0r
      @t3hpwninat0r Před 10 dny

      It makes a reference to the primary asset ID. That's why the blueprint has to be a child of "PrimaryDataAsset" - it has all the code already included to generate its ID.
      You might find it useful/interesting to read about primary assets and secondary assets in the UE docs :)

  • @AkitaMix
    @AkitaMix Před 2 měsíci

    the most important question is how to dynamically find the DA so you can use it inside the bp?

  • @magnawiz
    @magnawiz Před rokem

    I'm making a cooking game with different dish recipes and combinations of ingredients. Should I be using data tables or data assets?

    • @tjrizvi251
      @tjrizvi251 Před rokem +2

      I would assume data tables?

    • @magnawiz
      @magnawiz Před rokem

      @Ray Edwin I see. I've also been experiencing some bugs with 5.1. Mainly with UI stuff.

  • @Kappinski
    @Kappinski Před rokem +1

    Can I make a Data Table of Data Assets?

  • @dreamingacacia
    @dreamingacacia Před rokem

    So this is basically just self-complete data table. It's a higher form but could become more costly. Would love to try it, but I'd need to see more use cases before I get the ideas of how would I use this instead of just using the data table.

    • @shaqm0bile
      @shaqm0bile Před 9 měsíci

      Yeah this is exactly what i was thinking. The data assets being able to run their own functions on themselves is cool, but other than that it just seems like data tables that are messier to manage. I'm sure there's a super useful case for them (and they are probably working on that as they grow the feature) but for now, even in 5.3, it seems not very useful.

  • @MEMUNDOLOL
    @MEMUNDOLOL Před 10 měsíci +1

    whats the point, i see no diff with just using data tables and structs

    • @allashama
      @allashama Před 7 měsíci

      I also dont see. With Data Assets you end up with 130 assets lol, 1 for every objects you have, like weapon, food, decorative stuff...
      I think i still would use DataTable with Structure then using DataAsset.

  • @HKgunner
    @HKgunner Před rokem +7

    1:00 | 5:53 - Click those timestamps over and over again for an authentic Deep Rock Galactic experience.

  • @marcapouli7805
    @marcapouli7805 Před 10 měsíci

    Finally after 10 yars of hard work, I realize I don't know 1% of the engine, and I understand why I never earned a cent. Maybe in 100 years I will know enough to make a game. Oh wait, in 100 years there will be so many new features I will still be at 1%. Completely demotivating and depressing.

    • @marcapouli7805
      @marcapouli7805 Před 7 měsíci

      ​@@ericfieldman This is what I always tried to do, the first issue is to come up with something cool. Game design is a whole competence, anything I think is cool isn't cool for others.
      Then I agree about researching the steps, but that isn't that simple. Each step requires professional expertise, and is just a succession of unplanned issues that I can't solve at some points.
      When I spend entire weeks on a particular problem and don't find the solution, I have 3 options. Paying a professional 1 year of my income for 1 or 2 hours of work but I already struggle to eat (I live with social minima), asking for help but people on the forum only speak to themselves, I have stopped trying to get answers there several years ago since there is no answers. Last option is the one I always "choose", give up the project and try another cool one that I will give up at some point. That is the loop I'm stuck in for a long time now.

    • @garethanderson6980
      @garethanderson6980 Před 6 měsíci

      @@marcapouli7805 Dont beat yourself up, everyone and i mean literally everyone goes through this, it takes time and i mean years to understand completely everything with tools like unreal. What I tend to do is just dot around watching videos go outside make myself busy doing less complicated stuff if im stuck on things.

    • @Zslaboratories
      @Zslaboratories Před 6 měsíci +3

      Even the people building unreal don't know everything it has, you don't learn the entire engine then make a game, you design your game then start building it and learning needed things as you go along. 1 or 2 basic game courses to go through full steps on a small learning project first is enough then get cracking on your game

    • @ericfieldman
      @ericfieldman Před 6 měsíci

      @Zslaboratories I'm realizing over time that learning just for the sake of learning can be fun, but it should never get in the way of keeping your world small enough to navigate and building it purposefully. Every new electronic advancement wouldn't exist if electronics weren't popularized by earlier devices, and those earlier devices wouldn't exist if we didn't discover electricity in the first place. If you get in the mentality of "I'm not legit cause I don't see more of the bigger picture" it's a neverending journey trying to do that that you won't enjoy, because fundamentally you're trying to prove you can do something inhuman and eternally failing. Best we can do is say "that's above my pay grade" and clarify what we want to see, and then make it happen, focusing entirely on the task itself unless we want to go bigger and have a truly good reason to do that. Otherwise, trust that whatever info we need will come to us when we need it to if we do a bit of looking

  • @domi_dreams
    @domi_dreams Před 11 měsíci +3

    There is no advantage to regular DataTables. It's more tedious/more clicks to create/edit these singular resources, than just adding another entry in the table. Also table is more versatile, you can search it, filter, sort, etc. You can write static functions/Blueprint Function library - to act on rows in DataTables as well.
    You haven't discussed ANY noticeable advantage of using them compared to good ol' DataTables, sorry.. :(

    • @ethanwasme4307
      @ethanwasme4307 Před 9 měsíci

      1:03 bruh... literally dismantled your entire argument, go back to shiidot and learn the basics and (some manners) before moving onto visual scripting

  • @DailyPaily
    @DailyPaily Před rokem +9

    More tedious work.

  • @user-li7ce3fc3z
    @user-li7ce3fc3z Před měsícem

    Нужно больше информации про async load primary asset