Blog Archives

UE4 Binary Builder

Want to make your own binary build of Unreal Engine 4 to distribute among your team members?

Download this app then:

Source code:


[TIP] Creating your custom definitions for your UE4 games

Some developers might require their game to be different based on specific builds. For example you make a game and you want to release a demo but don’t want to include certain features. This is actually very easy to achieve. Like literally…very easy. 🙂

Open your MyProject.Build.cs file and modify it like this:

/* True if this should compile as a demo build */
const bool bIsDemoBuild = true;

/* Add a new definition called IS_DEMO_BUILD. This will be 1 (true) if bIsDemoBuild is true. Else it will be false (0) */
Definitions.Add(string.Format(“IS_DEMO_BUILD={0}”, (bIsDemoBuild ? “1” : “0”)));

Close your project solution file, right click on your *.uproject file and select Generate Visual Studio project files.

Generate Visual Studio project files.

That’s it! In your header/source files you can now use like this:

UE_LOG(LogTemp, Log, TEXT(“This is a demo build”))
UE_LOG(LogTemp, Log, TEXT(“This is release build”))

The good thing about this approach is its not just a simple if else condition. The compiler is actually removing the entire code inside that macro based on the condition. 🙂

[TIP] Generating Build Numbers for your game

When i am compiling my projects i would like to know how many times i compiled my project. So i made that kind of functionality for one of our project and thought i’ll share it with you guys. 🙂

First of all you need a header file to track the game build changes. Here is a screenshot of my header file from our project. Its called GameVersion.h



Next i created a simple text file called GAME_BUILD.txt and it contained only the build number. Nothing else. This file was located in my Project Source/Project Name folder. (for example: D:\Unreal Projects\MyProject\Source\MyProjectFolder). Here is a screenshot of that file.



Now comes the real part. Go to your Project Folder/Source and open up MyProject.Target.cs file. Here in this screenshot you can see how i modified the main function. Modify it like that and make sure to point to your GameVersion.h and GAME_BUILD.txt files correctly.

Target.cs file

Target.cs file

Now every time you compile your project it will automatically increment your build number. To access this build number simply include GameVersion.h file  and get GAME_BUILD_NUMBER. 🙂

Compile Output

Compile Output

Hope this tip was useful. 🙂

NOTE: The only downside to this method is it will always increment the build number even if your project fails to build.

%d bloggers like this: