Disabling unneeded C++ modules

UE4.10.3

I found this question, but it was never answered. https://answers.unrealengine.com/questions/222068/how-to-disable-compile-some-of-the-modules.html

When I build from the source version of the engine, it builds lots of modules that I don’t need.

What’s the proper way to disable modules that I know I definitely don’t need (I have Paper 2D game so I definitely don’t need Landscape and Foliage, etc).

In my Build.cs file I only have PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D" }); but I still see lots of unneeded modules being compiled.

Hello,

I’d like to clarify something. Are you asking if you can exclude modules from a source build when building it through Visual Studio, or are you asking if you can exclude them from a packaged version of your game?

Thank you for the clarification. Only the modules that you include in the Build.cs file should be included in the package.

What are you seeing when you package your game with those files excluded?

I want to exclude them from the packaged versions to make IPA and APK smaller.

I see modules like Foliage, Landscape, MoviePlayer, etc. My game doesn’t use those and they aren’t in Build.cs, so it would be great to omit them from binary to cut down its size.

Hello,

I have received more information on this topic. Removing C++ modules is not something that we support currently. While you are welcome to experiment with it, there is no guarantee that your game would function properly with some modules removed.

Also, keep in mind that removing some modules may not make much of a different in terms of file size, and the amount of effort required to do so may not be worth the decrease in size.

Have a great day

Thanks for clarification

Hey Sean, do you know if this is something that is planned at all by now? I’m sick of recompiling/linking things like OnlineSubSystemOculus (and like 100 more…) when compiling Development Editor.

Hi DaFox,

I spoke with one of our developers to double-check on the progress of this, and the long term plan is to move things into plugins where we can, but it’s going to happen slowly over time.

The example that you are giving, OnlineSubsystemOculus, is already a plugin, so you should be able to just disable it in your project through Edit->Plugins.

Also, a note: if you are building the UE4Editor target rather than your game project’s editor, it is meant to build all plugins since it is usable by any content-only project.

Hope that helps!

Thanks a lot Sean!

I think that actually cleared up some confusion I had about the build targets. (I think build targets in general could use a more straight forward documentation pass. Currently there’s just a like a really short basic “when you first start do this”, and then an overly complex “here’s how it works internally” section.

I’m really looking forward to things like build time and general workflow improvements. That’s my biggest issue coming from Unity.

1 Like

Hey again Sean, I just wanted to provide an update; that note about the UE4 target was huge!

When I do a clean build with that target I build about 2100 items. When I build the target for our game we get down to 1400. I expect this could end up under 1000, but we still see things like OnlineSubsystemOculus and RHI’s that we don’t use get built, so there’s still some progress that could be made. Hopefully the engine continues to get modularized because not everyone has the computation power and money to to throw at build times.
When our non-editor targets get built we’re down to ~400 build items.

Hi Sean , I`d like to give plugin-developers a engine with no .cpp. for example,first I build a engine and delete all the .cpp files in private folder,then i give these files and dlls to plugin-developers. they use this engine version to create their plugin ,build and test. My idea is to skip build all the modules which have no .cpp,I am not sure if it is possible.Could you give me some advice