Keeping track of different builds of (Unity) games can occasionally be convoluted, especially if you’re in a workflow where you also have to provide installers with your builds. With different testers potentially testing different versions, it’s easy to lose track what bug is fixed in what version or build.
Luckily, Unity3D is based on Mono (.NET), and therefore the problem can be solved by simply dropping in a new MonoBehaviour
. Read on for how it works.
The following script uses the assembly version property to keep track of the version number. It has the format of major.minor.build.revision
. The first two numbers can be set by yourself, the following two are set during build time (but could also be set manually, if you wish so). The build number is increased every day, the revision number every second (and resets once a day).
And just like this, your different builds will get a new version number every day, without you having to lift a finger.
The script is set up to show the version number in the first 20 seconds the game is playing and emit the version number in the log file, so your testers can give you feedback which version they tested, but of course you could adapt that to your own needs.
Additional Hints
Depending in which folder in your Unity project you place this file, either the CSharp or CSharp-Firstpass assembly will get the version number you define here. This version number will also be set as the built assembly’s version number. If you are using an additional tool that creates an installer for your game, you could set up that tool to read the version of that DLL in order to set the version number of your complete project.