If you’re going to be putting builds of a game in development into the hands of testers frequently, keeping track of what build they’re playing with can be crucial to tracking down bugs. For the most part, you might be able to tell a build by a major new feature or other visual change. As those builds become more frequent though, especially between strictly bugfix builds, you’re going to have a much harder time determining what build the user has without explicit definition somewhere.

What you could do is simply throw a static string in some class, and update it every time you kick a new build out. You could also stick your hand on a hot oven. Neither of those options sound very fun to me, though.

Overview

I create a static class that I call AppInfo. In this class I have a bunch of strings and ints that don’t change very often, if ever:

Company Name Zapdot

Zapdot Long Name Battles of Ug’Matumtum: Acid Reflux

Battles of Ug’Matumtum: Acid Reflux Short Name, without punctuation ugmatumtum This might be used for a filename or path.

ugmatumtum Major version 0

0 Minor version 1

1 Apple App ID 0123456789

0123456789 Apple Bundle ID com.zapdot.ugmatumtum

com.zapdot.ugmatumtum Steam App ID 9876543210

With this, I can easily create build scripts or UIs that use this information. The most important string that I’ve got in this class is AppInfo.fullVersion, which includes the major version, minor version, build date, and build count.

The build date is formatted YYMMDD (for sorting purposes) and the build count is simply an incremented integer to differentiate multiple builds on the same date.

Storing the Data

I want the data to be easily available to both the editor and the built project. I’d also prefer that the user cannot easily access the data of this file to edit it and potentially introduce confusion with bug submission. To accomplish this, I store the data in a comma-separated format within the Resources directory.

The Goods!

Throw AppInfo.cs in Scripts/ProjectSpecific/AppInfo.cs

Whenever you need to increment the stored build number, call the following function (editor only):

AppInfo.IncrementBuildNumber();

Whenever you want to print or display the full version, simply print or display this string:

AppInfo.fullVersion