Master Unreal Engine: Understanding Hard and Soft References

Поделиться
HTML-код
  • Опубликовано: 11 июл 2024
  • ХоббиХобби

Комментарии • 78

  • @DanGoodayleUnreal
    @DanGoodayleUnreal  8 месяцев назад +10

    Trying something a little different, instead of a disembodied voice talking I wanted to have something on screen that was a bit more interesting to watch than whatever my mouse was pointing at. This was an experiment so let me know if it's working or not, if it's distracting / getting in the way from what I'm talking about let me know 😶

    • @chasesommer
      @chasesommer 8 месяцев назад +1

      I like seeing your beautiful face

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  8 месяцев назад

      @@chasesommer 😅 thank you!

  • @acesonfire
    @acesonfire 3 месяца назад +3

    I have been about to pull my hair out trying to wrap my mind around this, I have probably watched close to 30 different videos attempting to explain this concept. Yours is the one that finally made me get it. Thank you.

  • @SphealIcecream
    @SphealIcecream 12 дней назад +1

    I recently got asked about this during a job interview! Thanks for covering it!

  • @draftdrifter5779
    @draftdrifter5779 3 месяца назад +2

    Great video. I love the fact that you show both blueprints and C++. Hope you continue making more!:)

  • @xultix
    @xultix 8 месяцев назад +4

    Just saying Thanks for these kinds of videos, definitely things I wasn't really thinking about as I started dabbling in unreal engine again so always good to know and expand my knowledge!

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  8 месяцев назад +1

      Glad I can help! The engine is pretty huge but if you break it down into manageable chunks it's pretty awesome. Best of luck with your projects!

  • @user-lo5um8zh8z
    @user-lo5um8zh8z 7 месяцев назад +1

    your video is greatest i've seen a couple of them and i've learned so much. Expecting for your gameplay ability series~

  • @SuperLordee
    @SuperLordee 3 месяца назад +1

    Thank you for this video this was extremly helpful since you also showed in C++!

  • @Daniel-be6cj
    @Daniel-be6cj 3 месяца назад +1

    This is great, I had changed some skeletal meshes I wanted to load to a soft reference but they weren't loading, the async load node was exactly what I needed. Thank you!

  • @C4RL054321
    @C4RL054321 8 месяцев назад +3

    Great video Dan, I've recommended it to my team 😊

  • @unreal_metronomus678
    @unreal_metronomus678 2 месяца назад +1

    Earned a sub. Really very well explained, thanks a lot!

  • @ThadeousM
    @ThadeousM 6 месяцев назад +1

    I'm just starting out and so far all the info I've coming into contact with suggest going straight to BP Interfaces rather that Casting so thank to folks like yourself for continuing the convo

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  6 месяцев назад

      Interfaces are a great way to keep things decoupled, good luck with your projects!

  • @draicor
    @draicor 5 месяцев назад +1

    This video was amazing, thank you mate

  • @GarethNN
    @GarethNN 5 месяцев назад +1

    Great explainer, thank you!

  • @libertarianterminator
    @libertarianterminator 8 месяцев назад +1

    I was trying to get my head around using triggers in my VR project and I saw the notes that said casting is taxing. This video explained neatly how to do it right. Thank god I found this before I implemented too many features! Keep making videos about UE, you are great!

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  8 месяцев назад +1

      Glad it was helpful!

    • @ethanwasme4307
      @ethanwasme4307 8 месяцев назад +3

      On the bright side, if you're already hard referencing the cast is near free xD

  • @alexkulev352
    @alexkulev352 7 месяцев назад +1

    Very clear explanation. Gonna use this video every time I need to pitch the necessity of the soft refs to designers :D

  • @ian_snyder
    @ian_snyder 4 месяца назад +1

    Great info, thanks!

  • @0xJarry
    @0xJarry 8 месяцев назад +1

    Great video and examples

  • @eduard2630
    @eduard2630 6 месяцев назад +2

    Briliant! Thank you so much for this particular video. After reading 5 pages long articles full of water with as much sense as "games made with Unreal Engine use RAM", it makes me uneasy, that the concept of hard/soft references technically could be explained in one sentence lol I've recommended this video to all my fellow UE devs just in case hehe

  • @julienpaul4899
    @julienpaul4899 4 месяца назад +1

    Merci beaucoup !

  • @ReubenAStern
    @ReubenAStern Месяц назад

    C++ eh?! That's gonna make me subscribe!! For some reason every Windows IDE I use works for a while then tells me all my code failed. But I'll get back to learning C++ one day.

  • @Mr.Sunshine2023
    @Mr.Sunshine2023 8 месяцев назад +1

    wow, nice, thanks

  • @crispychicken143
    @crispychicken143 8 месяцев назад +1

    good stuff

  • @Whiskeysim
    @Whiskeysim 8 месяцев назад +4

    Good video, but you should check your audio levels. I had to crank my volume to like 85% just to be able to hear you. My average volume sits at 6% if that gives you an idea.

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  8 месяцев назад +1

      Thanks for the feedback! I'll give normalising the levels a shot for the next video, I've been using headphones to review before hand so far, so that's probably the cause of it!

    • @Whiskeysim
      @Whiskeysim 8 месяцев назад +1

      ​@@DanGoodayleUnreal Yeah doesn't change the quality of the video in anyway, but having to scale the sound so high makes notification sounds from like 'Discord' mildly fear inducing haha.

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  8 месяцев назад +1

      @@Whiskeysim hah I totally get it! Honestly each video I'm trying to change something to improve things gradually over time, I'll give the audio more of a look on the next one's and see how people react to it.
      Thanks for your time letting me know, it really helps me figure out how to do all this 🫡

  • @vinreals5694
    @vinreals5694 5 месяцев назад +2

    A few spots that are not correct. Objects loaded through soft references won't stay in memory forever. If there is no hard reference pointing to that object, Garbage collection will step in and delete that object. That's why you don't see soft references get unloaded in source code.
    Loading assets synchronously is not always bad. That's where the loading screen comes in. Lyra uses it extensively to load in crucial assets for the shooter core.

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  5 месяцев назад +1

      Heya, thanks for the comment,
      If you stash the handle from the streaming manager, you have to manually release it for the objects the then be GCd, that’s what I was getting at. If you store off hard references to the objects and don’t stash the handle, they will be GCd the moment the hard reference is removed.
      Sometimes you might want to preload a bunch of things but not necessarily keep them referenced directly, for example having a bunch of frequently loaded / unloaded equipment on a character. Preloading and stashing the handles allows for faster loading during gameplay.
      Sync loading assets isn’t always bad, but if you can asynchronously load you don’t block the game thread for an undetermined amount of time, allowing you to give the players some feedback on what’s happening. Of course if there is a static loading screen you may want to just sync load, but if it’s animating on the game thread (via UMG, which I think is -only- game thread) then you will have it freeze until the load is done.

  • @Borszczuk
    @Borszczuk Месяц назад

    Can you please explain why (@4:38 +/-) you connected input of conversion pin to the "Montage to play" output and not to the Async Loader's "Complete" output? To my understanding, since the loader is async loader you would simply "fire" conversion pin too early, no?

  • @mangarookie
    @mangarookie Месяц назад

    Hey Dan thanks a lot for the tutorial. I have a little question thou. When I async load a soft class reference, do I not need to get the handle and unload/cancel it? Also what will happen if I async load a soft class reference in a struct?

  • @lespaul1507
    @lespaul1507 5 месяцев назад +1

    Thanks for the video. Im new and trying to learn all this stuff. My main character BP is like 400mb. Im trying to make sure nothing else references it to avoid them going from a 10mb BP to 410mb BP. But as soon as I connect them to a BPI, they are already 410mb. Maybe its the way im doing it, I have to play around with it more, but can you still make a hard reference with BPI? Maybe thats what im doing..

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  3 месяца назад

      What’s showing in the reference viewer for the asset?

  • @imyokoyoko
    @imyokoyoko 6 месяцев назад

    Can i use soft references to prevent the "Accessed None Trying To Read Property" Error messages? I have certain blueprints that, just for a moment, do that, then the asset loads and works properly.

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  3 месяца назад +1

      Soft references wouldn’t load the object implicitly, you have to manually load it.
      So if you wanted to use a function on it they would throw an error because it wouldn’t be loaded until you (or something else hard referencing it) loads the object first.

  • @ethanwasme4307
    @ethanwasme4307 8 месяцев назад +1

    Something else i'm trying to tackle before scaling is circular dependencies

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  8 месяцев назад

      Forward declare what you can, interfaces help too

  • @Aantjack
    @Aantjack 3 месяца назад +1

    So, for example, when I spawn in AI characters I would use hard refrences? What is a must use case for hard refs?

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  3 месяца назад

      Let’s say you have 100 different AI character types.
      You would create some sort of data asset to manage them, you then use soft references to all of them.
      Now to load that data asset you don’t then need to load all 100 AI characters (if they were hard refs you would have to). You could then take 5 of the characters and load their soft references into memory, then spawn those characters.
      Does that make sense?

  • @MonderMurshed
    @MonderMurshed 5 месяцев назад +1

    Thank you!
    but i have 2 questions.
    1 - Can the same actor or class be loaded in the memory more than once? because if it does i must study more about these things.
    2- if i did everything in hard reference it means all my stuff will be loaded in the startup of the game (everything?)
    Thanks again for the video and i will be grateful to see your answers!.

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  3 месяца назад +1

      1) No, the actor class defaults object will only be loaded into memory once. At that point any soft references to that object will then point to that.
      2) yes in theory if you had a single object referencing every asset you could. You can also inadvertently load more than you want if you aren’t careful with hard references (loading a UI element which has a hard ref to a character BP for instance would load that BP too)

  • @lospe85
    @lospe85 5 месяцев назад +1

    so, if i have a master Item blueprint (lets calle it BP_Item), parent of all items in the game. This BP_Item executes a "Get Data table Row" at some point, so it takes a DataTable as a hard reference, therefore loading the whole datatable into memory. Now let's say I have 20 items (children of the BP_Item class), does it means that the DataTable is being loaded 20 times in memory, using 20x memory usage? Or... if the DataTable is loaded for the first item to spawn, then the remaining 19 items will use that reference in already loaded in memory (no duplication)?

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  5 месяцев назад +1

      It'd only be loaded into memory once

    • @lospe85
      @lospe85 5 месяцев назад +1

      @@DanGoodayleUnreal thanks for you answer!

  • @unreal_metronomus678
    @unreal_metronomus678 2 месяца назад +1

    Hi Dan. I´ve notived something strange. I´ve hooked a soft reference variable (anim montage) to a blueprint interface. In the bp that receives the interface message, I dont have to load the montage into memory, I can just pass it into the play montage node. Where does the anim montage get loaded?

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  2 месяца назад

      So the blueprint interface requires a hard ref and you are pass in a soft ref?
      If you try and do that it'll do a cast from soft to hard ref (in blueprint it'll look like a light blue dot changing to a darker blue dot).
      If the asset has been loaded previously (and is still loaded) it'll resolve to the correct asset, however if it hasn't been loaded it'll return a nullptr. This can lead to odd behavior in cooked builds, as you may load the asset without knowing in the editor (you can load an asset in the editor just by double clicking it), but in a cooked build that asset may not be loaded.

    • @unreal_metronomus678
      @unreal_metronomus678 2 месяца назад +1

      @@DanGoodayleUnreal Hi. Thanks for the reply. No, I passed a soft ref in the interface. In my player bp I defined the soft variable "deathanimmonatge" (and entered the anim montage) and hooked it up to a interface function (soft ref) . My gameplay abilty uses the interface to pick up the montage. But I can just hook up the interface node in my ability bp to the play montage node and the anim play without having to load the asset. I haven´t opened the montage in the editor, so I don´t know why I´m am not getting a nullpt :-/ . very odd..

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  2 месяца назад

      Could you grab some screenshots and post them here? Feel free to retract whatever you'd like, but it'll be helpful to debug things - and for anyone curious reading the comments :)

    • @GlassesAndCoffeeMugs
      @GlassesAndCoffeeMugs 2 месяца назад +1

      @@unreal_metronomus678 Cook the game in development mode and log whether the soft ref is valid when you aren't expecting it to be. The editor is super unreliable when it comes to debugging stuff held in memory. If it is valid and it shouldn't be, there's a 100% chance the asset is being hard-referenced elsewhere, which you can use the reference viewer to check.

    • @unreal_metronomus678
      @unreal_metronomus678 2 месяца назад +1

      @@GlassesAndCoffeeMugs Yes, after restarting the computer for a couple of times, I I got an error message that the asset wasn’t loaded ( correct behaviour) . Hmm, yes, you are right about the editor being unreliable sometimes .. anyway, thanks for your reply.

  • @a2b2tv
    @a2b2tv 8 месяцев назад +1

    🥰

  • @scislianlongshadow
    @scislianlongshadow 2 месяца назад +1

    I do not have this damn async node, Unreal 5.3 I have in no blueprints been able to call this async node. What in the heck am I supposed to do.

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  2 месяца назад

      Which async node are you after? I think that was on the version before (can’t check right now I’m travelling)

  • @lorenfulghum2393
    @lorenfulghum2393 2 месяца назад +1

    your audio volume needs to come way up

    • @DanGoodayleUnreal
      @DanGoodayleUnreal  2 месяца назад

      You aren’t the first person to say that! I’ve been trying new settings in later videos so hopefully that’s fixed. Hope the video itself was okay