[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

GameVersion.h

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.

GAME_BUILD.txt

GAME_BUILD.txt

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.

Advertisements

About Satheesh (ryanjon2040)

Genuine Unreal Engine user

Posted on July 31, 2015, in Unreal Engine 4 and tagged , , , , , , , , , . Bookmark the permalink. 3 Comments.

  1. Thanks for the tip, Satheesh!

    Like

  2. Awsomeman328

    Does this change the ‘Project Version’ setting in Project Settings or is it it’s own separate thing?

    Like

  3. Thanks for the tip! Just a minor tweak I implemented when using this scheme: Directly edit the GameVersion.h from the build.cs file. No need for a Game_build.txt file.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: