[BUG ?] Why Async loadind asset Unload always fails?

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 :

111028-nonetarget.png

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 :

111029-pre+garbage.png

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

Hello Guys, I manage to free memory if I call ConditionalBeginDestroy on the object after called StreamableManager Unload but I cant load anymore the asset, the manager don’t find it.

I really need help on that one guys, I can’t belive nobody successfully load and unload an asset with Unreal that’s unbeliveble.

Is there a way to do it ?

Is it the right thing to do, calling ConditionnalBeginDestroyed on object after called Unload ?

Can someone at Epic can help on that one ?

because we need that to be able to port the game on console.

Also, what’s the purpose of unload if it doesn’t unload the asset ?

Wandering around for 4 days now and I really need help please.

Thanks

gamer08

Hey gamer08,

Thanks for the information. I am able to reproduce the issue you have described and entered a issue report for it. You can follow it here:

link text

Hello Kyle,

Thanks for you answer.

I maybe find a workaround that let me Load / Unload with that code below

void ACGameMode::UnloadDummyTest()
 {
     UCGameInstance* gi = Cast<UCGameInstance>(GetGameInstance());
     if (gi)
         {
            gi->assetLoader.Unload(tempRef);
            tempRef.ResolveObject()->MarkPendingKill();
	        GetWorld()->ForceGarbageCollection(true);
         }
 }

That way it’s really unload.

Can you confirm that is good ? bad ? valid ? or invalid ?

Is there a better thing to do ?

Thanks

gamer08

P.S We use Unreal Engine 4.12.5 for the game and you marked 4.13 in the bug report

If that works, I would say its fine, until they fix the issue with Unload.

If Unload is working and I simply missed something, I’ll update this post with that information.

The bug exists in 4.13.1 and because its the most current release, that’s what it will be logged under. (We log bugs under the most recent stable engine version available, that they exist in.)

Hello Kyle,

Thanks for the answer. I will use this workaround for the moment.

I tested with RequestedAsync, SimpleAsync and SynchroneLoad and the workaround works.

I’ll check this thread frequently for any updates, I may be missed something too. :slight_smile:

Thanks again.

gamer08