SOFT Object References in Unreal Engine EXPLAINED

preview_player
Показать описание
You always hear people complain about how bad casting is, but then those same people rarely cover that even if you avoid a cast, if you have hard object references you're still off just ad badly, so today let's take a look at the issues with hard object reference and how to use soft references instead!

Join this channel to get access to perks:

Рекомендации по теме
Комментарии
Автор

after you do the load thing for the soft object referenced variable, it will stay in memory as long as that variable still has that value. later on you can set the variable to some empty value and the space in memory for the class will be marked as "ready for garbage collection" and the engine will know that when it needs to free up some memory (garbage collection), that space in memory is a good candidate.

thpwninatr
Автор

again this is why I like your videos. I know there are already some other videos explaining soft ref but in general I found in your content "tip and trick" for someone who already have time in unreal engine and it's useful info for having later. Thank you so much!!

GiulianoVenturo
Автор

Wow I had no idea about this and the potential impact it has on performance.
Thank you, very informative👍

joeypouladi
Автор

It's tricky to know when to use this. It seems like a problem with this is that your game has to wait for soft object references to load while playing the game. Fine for something incredibly small, but you don't want your game to lag every time you have to play an animation. Also, soft object references are NOT freed up when your ability or whatever ends. In C++ you have to delete the pointer, but you can't do that in BP so it stays loaded until the game is closed. Soft references are one way you get memory leaks in BP iirc, so be careful.

YoutubeAccountMan
Автор

This was so much more comprehensive than similar content I've seen regarding soft references <3

HoduAphrodite
Автор

easy way around loading multiply assets is to use gameplay tags/string/enums to idetifiy which phase of attack or which attack needs to be loaded then use a select to run the branch you need. Allowing you to know chain 100 async load nodes but rather just call the ones you need.

akumadj
Автор

today i really got actual concept of soft reference. Thanks

vivegamespk
Автор

Thanks. How do you get the reference viewer to show the whole reference chain instead of just one reference layer at a time? Didn’t know that was a feature.

owencoopersfx
Автор

Great video! Could you do an async load when a specific weapon is activated? Rather than when the player uses that ability? So, when the sword is your primary weapon, any montages needed for the sword weapon are pre-loaded before the actual ability is fired by the player.

MichaelGaskin
Автор

would sequence be better for async asset loading? also is there no such thing as async all or all settled in unreal/cpp? group all async calls into a single async listener that waits for all calls to finish?

stereocodes
Автор

so would you say if you know an actor is definitely going to be loaded in a level anyway its ok to have it as a hard reference?

e.g i have multiple instances of a BP_House that is present pretty much throughout my entire game - that sort of thing would be ok to hard reference as it will always be loaded?

TheFlyingEpergne
Автор

comment for the algorithm!
I was looking at the soft ref today, tried it and the compiler crashed, I shrugged and moved on. Now I know I have some optimizations I need to do -.-' I appreciate the priority list at the end there, actors and static meshes with textures.

haxan
Автор

the annoying thing is async node doesn't return the exact class

vrai_
Автор

I keep all my montages in a map with enum selections. I could probably convert them to soft refs and have the selected montage feed into a single async node, which is in my function called Montage Picker. Then montage picker can have a pin to plug into the anim montage player. I'll test it out.

dreambadger
Автор

1:00 OMFG!!! I click here and see then my idle animation have +100(!)mb unlike of other animation of walking and other things (+\- 10mb)
Thank you for showing this tool :3

TheModExperiment
Автор

Can you not just use the Async Object out pin instead of hooking up the variable Directly, Or am I mistaken?

BaseRealityVR
Автор

I understand streaming and why its useful but in 99% of scenarios I struggle find good reason for where and when its "OK" to have to wait for an object. If its not time sensitive then its cosmetic and can async load. If its not cosmetic then I need that object now to effect the game and async loads are going to delay the gameplay making a laggy mess. Lemme know what you think if you see this. What are good ways to load async and bad ways to load async.

Siphonife
Автор

Unloading process? How to free memory when animation done playing.

sarfraz
Автор

If an object exists in memory and you perform a "successful" cast (hard cast) it will have no ill effects because the object is already loaded into memory.

that makes sense, but the part that confuses me is why is it bad to have a Cast just laying around, you could have as many cast as you want and there will be no negative side effects because it is already loaded in memory...unless each cast actually creates a copy of the object it is casting to in memory. Each time you cast you have to create memory big enough to hold the object.

Or maybe we are talking about two different types of memory: RAM and ROM(Disc) memory. maybe a Hard Ref will place an object in RAM even if you might not want or need it there yet resulting valuable recourses being unnecessarily used. I am still not sure; could you explain Hard and Soft reference as the relate to RAM and Disc memory?

dougwarner
Автор

omg you need to use interfaces to stop all those hard references. lol

osgisnk