hello guys,
I’m working on a game and I got the task to optimize memory usage because we would like to port the game on console.
I’m using FStringAssetReference and StreamableManager to async load assets for the game.
.h
UPROPERTY()
FStringAssetReference tempRef;
.cpp
void ACGameMode::LoadDummyTest()
{
UCGameInstance* gi = Cast<UCGameInstance>(GetGameInstance());
if (gi)
{
tempRef.SetPath("/Game/Blueprints/Game/BP_Potato.Potato_C");
gi->assetLoader.SimpleAsyncLoad(tempRef);
}
}
void ACGameMode::UnloadDummyTest()
{
UCGameInstance* gi = Cast<UCGameInstance>(GetGameInstance());
if (gi)
{
gi->assetLoader.Unload(tempRef);
}
}
For informations, theses 2 functioncs are blueprintcallable on separates buttons, the potato asset is a blueprint classs derived from custom actor c++ class and is not referenced anywhere.
Load works because the object weight is 126mb (yes I know is big)
but when I call upload nothing happens in memory and i manage to find this code below with a breakpoint in StreamableManager code :
What the heck is that target with name “none” ? Where is came from ?
I mean when I load the asset I don’t store it anywhere.
So later on the pre garbarge collector I got my weak target pointer assigned to this “none” name object :
Finally, on PostGarbage collector he failed to unload because my weak target is assigned to this “none” taget :
I also tested with RequestAsyncLoading with the same result.
What the hell is the “none” named target spawned from nowhere ??
Do someone is able to explain me why unload fails ?
Do you have any ideas ?
Could someone at epic staff could explains me that please ?
It’s cool that you can load async, but if you cannot free memory it’s bad.
I really need help, (3 days wandering around).
Thanks for any help.
Have agood day.
gamer08