UE4 built from source takes 170GB disk space

Hello. Yesterday I built unreal engine 4.26.1 from the source. Out of curiosity, I went and check the size of the build + source combined, and my jaw just dropped. I have 500GB SSD, I don’t want to dedicate all my SSD to unreal engine. Is there any way to optimizations that I can do to reduce the size of this?

I also have 500GB SSD, and tried to reduce the size as much as possible. Mine is 90GB for UE 4.25.

I run setup.bat with this command line in order to exclude anything different then Win64 target

setup.bat --exclude=Mac --exclude=osx64 --exclude=osx32 --exclude=iOS --exclude=IOS --exclude=ios --exclude=Linux --exclude=linux --exclude=Linux32 --exclude=linux32 --exclude=Linux64 --exclude=linux64 --exclude=linux_x64 --exclude=Android --exclude=android --exclude=HoloLens --exclude=TVOS --exclude=Win32 --exclude=WinRT --exclude=winrt --exclude=HTML5 --exclude=html5 --exclude=XboxOne --exclude=Switch --exclude=Dingo --exclude=PS4 --exclude=Win32 --exclude=win32

In the UE4*.Target.cs I have these disabled, since I don’t need them:

bCompileAPEX = false;
bCompileSpeedTree = false;
bCompileNvCloth = false;

Recently , I enabled also the Windows compression, since the binaries/obj files compress quite well, and the slow down shouldn’t be much. This leads to 65GB

4 Likes

Besides ensuring that you do not have any files related to platforms you will not be targeting, not really.

Using compression will potentially slow down operations related to compiling and debugging.

The easier way to avoid the size issue is not to use a source built version of the engine, if you can help it.

So, the question is, can you help it? :slight_smile:

FYI, I have an entire 1TB SSD dedicated to our project.
Of that, roughly 700GB is used, though a number of that is due to having to build a binary for other people.

Thanks for the valuable explanations. Now I get that the problem is not me. It is just the way things are when you work with UE. I guess I am going to go for more storage space then.

Last year i purchased special USB TYPE-C M.2 box to compile UE5, already tested on UE4 and i am ready for UE5. developer100 thanks for setup.bat commands.

I also add a couple more excludes --exclude=Samples --exclude=Templates --exclude=FeaturePacks --exclude=Engine/Documentation --exclude=Engine/Saved.

I don’t recommend excluding templates unless you are not planning to add C++ classes at all.

Sorry for reviving an old post, but it’s been a while since I’ve built the engine from source…
I remember a 150+ GB size for the folder but 380GB is a bit too much IMHO…

Am I doing something wrong or is this normal?

Mine’s about 300, I don’t know what’s going on in your .git folder. Everything else looks about right.

You can start trimming the fat by deleting plugins you know you don’t need, like virtual production stuff probably if you’re a game dev.

1 Like

I also built UE 5.3.2 from source and my total disk usage of the built engine is ~ 300GB although I excluded any platform target (except Win64) I dont plan to use with the -exclude= option.

Seems we have to deal with it or remove plugins we dont want to use.

I also read you can delete the intermediate folder. But if you change something in the engine source files, you need to recompil it again from scratch.

Here is the link to this info:

And here is another interesting link, similar to the one above:

Update for 5.3.2:

I was able to reduce the build sitze from around 300GB to 160 GB. I think the mistake I made was that I built the entire solution instead of only the containig UE5 project.

Here is the proof:

After I have downloaded all the necessary files through the command line, I opened the project in VS 2022 and only built the project UE5:

It took 1h 42min on my intel i7 8700k and 32GB RAM

2 Likes

Is your git folder a shallow checkout? You probably don’t want all the old versions and separate branches.

I did not checkout the repository, I just downloaded the release via .zip file.

But, I recently tested packaging an emtpy project. I ran into the “windows sdk not found” error.

Maybe I excluded too many platforms to save on disk space.

I am currently re-building and this time not excluding any platforms to see if this method resolves the error.

I rebuilt 5.3.2 yesterday from scratch and strictly sticked to the official guide from epic games.

So no exclusion of platforms. Just executed Setup.bat normally.

Now my foldersize is 180gb, which is kinda acceptable. No windows sdk errors anymore and packaging seesm okay at first glance.

EDIT: yes, I can package the starter map without any issues.

I cloned only the 5.3 branch, using the following command that I got from stackoverflow:

git clone https://github.com/EpicGames/UnrealEngine.git --branch 5.3 --single-branch UE_5.3

I probably did the same accidentally, I’ll try to rebuild it as soon as I have some free time! Thank you for pointing this out!

It’s funny anyway because we’re happy that UE5.3 is “just 160GB” while the OP was complaining about its 170GB size :rofl:

2 Likes

Yes thats kinda funny xD But if we consider the possibilities that UE5.3 now has, this is relatively okay for me.

1 Like