Bug: LoadObject<>() can leave zombie files after game ends

The following code can lead to zombie asset files that work once, but cannot be subsequently loaded, after the editor session ends

auto particles = LoadObject<UParticleSystem<( /*asset path*/ );
particles->AddToRoot();

When I press the ESC key to end the game session I am frequently seeing this in my Content/Particles folder:

Note the 4 “None” icons. Subsequently running the game will cause warning about “could not load asset” in the log. However closing the editor and restarting works. I have tried calling ConditionalBeginDestroy() and RemoveFromRoot() in my game mode subclass’s EndPlay() to try to release the assets, without success.

I have seen similar issues with audio assets.

Clicking on one of the “None” files results in a log warning

LogUObjectGlobals:Warning: Failed to find object 'Object /Game/Particles/P_magicCircle1.None'

Hey lordGoldemort,

I’ve attempted to reproduce your issue, but I haven’t seen the same results when using this method in my project. Could you provide the full .h and .cpp files that you are using when you are seeing this issue occur?

Here’s the place where I do the loading

link text

Note that I am seeing identical results with FStreamableManager.

I am happy to send you a copy of the project if that isn’t enough?

Ah… may have found the source of the problem. I am calling ConditionalBeginDestroy() in the destructor of a class that has a particle effect in it. Removing that seems to cure it.

Of course I should add that whilst I can reasonably expect an exception from multiple deletes of an entity, corruption of the resource it is based on is not a good thing.