Unity Resources RAM Usage

Hello,
It’s multiplayer game that using Photon. I have 15 car and 15 prefab in resources folder. I’m spawning single car but memory profiler show all car textures uses RAM. How can I prevent that? Thank you.

Hi,
You can avoid that by not using the Resources folder, which makes detailed and controlled memory usage quite hard to achieve. It will be build into a single AssetBundle and then fully load the index into Memory. Assets loaded from it may remain in memory longer as needed in the scene and you have less control over when they get loaded in, as e.g. loading an object that references them will load them into memory. Instead, you can get more control by placing these assets in separate asset bundles. Consider using the Addressables System. The manual has further resources on this.

3 Likes

Thank you, If I use asset bundle, It will load into memory only required prefabs and referenced textures etc… right ? Can I use the Asset bundle without getting data from the internet? My main problem is memory usage :slight_smile:

Yes, you can use AssetBundles without downloading them from a server, you’ll just build them into the game and ship them all together.

And yes, depending on how you structure your AssetBundles, you can get fine grained control about which resources get loaded. That link I posted above leads to some further links and tutorials that should help getting you started :slight_smile:

2 Likes

Thank you for reply.
Have a good day.

1 Like