So you finally have your game in a place decent enough that you’d like to show it off to a few people. You go to build it for your desired platform and you notice that it’s taking longer than you expected to build. It finally finishes, and you go to the export folder only to realize the game is larger than you expected it to be. Like a lot larger. Like there’s-no-way-in-hell-I’m-paying-to-host-this-someplace big. That’s because by default Unreal engine builds everything when you build your game. So let’s say you downloaded a few asset packs or you have a bunch of not yet implemented or even unused deprecated code that your not yet ready to part with? Well all that just got compiled into the build you’re trying to export and that can massively inflate the size of your build.
In my search for a fix to this issue I came across a lot of interesting solutions including starting from scratch and copying over the necessary folders to the new build, meaning they had to redo all their key mappings and project settings… There’s an easier way people. Luckily Unreal actually makes it incredibly easy to only include in your build assets that are actually used in your game.
Step 1: Turn off the cook everything option
Step 2: Turn on compress cooked packages and build only maps
I’ve found that cooking only maps works well. If an asset is referenced from a map it will be included in the build. Checking the create compressed packages also really helps with final build size.
Step 3: Specify what maps your game uses
So now that you’ve told it not to build everything, you have to tell it what to actually build. Unreal allows you to specify which maps need to actually make it in to the build. This is useful for excluding test maps.
Step 4: Add any additional directories
A lot of people will only need the first 3 steps, but sometimes you need to include assets that aren’t directly referenced by a level. For instance if your spawning a mesh that doesn’t already exist in a level someplace. Unreal allows to to specify other directories to include as well.
Anyways that’s all for this week. Thanks for reading. I hope I was able to help someone out there who was dealing with Unreal bloat.