4 gigabyte "loading screen"

i have noticed that all unity games released (example: endless space 2) consume 2 - 4 gigabytes for a simple main menu with 4 buttons.

in pure c, this menu would have taken 100 bytes at max.

So unity consumes 4294967296% more file size for a simple main menu than c.

Is this a bug with the unity engine ? Does it have to “preload” all potential models / textures / sprites of the game that will ever be used in the future, even for scenes that haven’t ever been loaded, and wont ever be loaded because player with just click “quit” instead.

If so how could one avoid this issue and load the resources only when needed in a scene.

At this rate, the next game will consume 100 gigabyte for a “now loading button”. Unfortunately, rams cannot hold more than 4 gigabytes.

All Unity games? That’s simply not true.

Superhot & poly bridge certainly don’t for example. It all depends on what the game is doing.

Unity generally only loads assets as needed, unless they’re in a folder called Resources.

I wonder if the games you’re looking at are doing things a bit wrong and throwing everything into the Resources folder, or if they’re intentially preloading everything for performance.

As an example my own Unity game uses around 150MB of RAM at the main menu and around 300-400MB while in-game with everything loaded.

This isn’t what happens, though; seems like you have a problem with your system. Building a project with an empty scene takes around 100MB of real memory (macOS 64-bit build). This is because it’s loading the entire engine. However scenes don’t use any RAM if they haven’t been loaded. I don’t have Endless Space 2, but I do have Endless Space 1, and when the main menu is loaded it’s using around 180MB. (It would take far, far more than 100 bytes in C, since there are various sounds/textures/etc. that are used.) If by “rams cannot hold more than 4 gigabytes” you’re trying to say that apps can’t use more than 4GB, that’s incorrect. RAM is typically 8-32GB these days, and you can use all of it. An old 32-bit Windows app can generally address around 2GB, but we’ve long since moved on to 64-bit, which has no such limitation.

The whole point of a loading screen is that it’s something simple to display to the user while the main body of a game is being loaded in the background.
So it’s not the “simple main menu with 4 buttons” that you can see that takes 2-4Gb of RAM - it’s all the rest of the game, and 2-4Gb for a modern game doesn’t seem too bad - most new systems come with 8Gb of RAM as standard, and gaming rigs often have much higher.