Topic: Force the game to delete and preload game objects to clear up memory

The engine preloads game objects one time during a game session. This is problematic for low powered devices because the game crashes when I create a long Story Mode. I assume it's due to ram/memory issues.

I want the main menu to delete/destroy all game objects created by the preloader so that the engine has to preload the objects all over again when replay a Story Mode within the same game session.

I hope this would clear up ram/memory issues for lot powered devices.

Share

Thumbs up Thumbs down

Re: Force the game to delete and preload game objects to clear up memory

Humm I'm not sure I understand what you mean.
Preloading in UFE works like this:
If you toggle "Hit Effects" the system will go over each game object under Global Editor -> Hit Effects, then over each character being loaded and search for every particle, projectile and any game object that can be potentially spawned during the match.
It spawns each of these game object temporarily (giving enough time to warm whatever extra effects might pop out during the preloading time), then delete them all before the match begins.
By toggling "Warm All Shaders" UFE also triggers this Unity function:

Shader.WarmupAllShaders();

https://docs.unity3d.com/ScriptReferenc … aders.html
If you haven't tested this yet, try untoggling this option and see if it makes any difference.

If you are however having issues with memory leaks or objects not properly being de-spawned during preload time, it could be a result of unwanted script attached to some of these game objects, perhaps forcing the object to remain active or spawning other objects that were not tracked by UFE.

If you prefer designing your own preload screen, I recommend disabling UFE preloader (Hit Effects and Warm All Shaders) and looking into the LoadingScreen prefab for alternative loading methods.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.
Don't forget to check our discord channel.

Re: Force the game to delete and preload game objects to clear up memory

Hello; I tried and I still got the error. But you were particularlly correct in your assumptions. The problem is caused by large uncompressed images that I loaded into the game in my latest update.

Thank you for your help.

Share

Thumbs up +1 Thumbs down

Re: Force the game to delete and preload game objects to clear up memory

Sprite sheets and sprite atlases can be very helpful if you haven't looked into those.

Share

Thumbs up Thumbs down