Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Extract the Version Information of a Game with Unity and C#

TwitterFacebookRedditLinkedInHacker News

If you play a lot of games, you probably noticed at some point in time that the version number or build number of the game is often presented clearly on the screen. This is often not by accident and is instead a way to show users that they are using the correct version of your game. Not only that, but it can help from a development perspective as well. For example, have you ever built a game and had a bunch of different builds floating around on your computer? Imagine trying to figure out which build is correct without seeing any build or version information!

In this tutorial we’re going to see how to very easily extract the build information defined in the project settings of a Unity game.

If you came here expecting something complex, think again, because what we’re about to do won’t take much. In fact, to get the version number you really only need the following line:


However, printing the version number to your console isn’t really going to help anyone.

Instead, you might want to create a game object with a Text component attached. Then when the application loads, you can set the game object to display the version information on the screen.

Start by creating a VersionNumber.cs file within your Assets directory. In the VersionNumber.cs file, add the following C# code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class VersionNumber : MonoBehaviour {

    private Text _versionNumberText;

    void Start() {
        _versionNumberText = GetComponent<Text>();
        _versionNumberText.text = "VERSION: " + Application.version;


Like previously mentioned, the above code will get a reference to the Text component for the game object this script is attached to. After, it will set the text for that component to the application version. This will work for all build targets.

Attach the VersionNumber.cs script to one of your game objects with a Text component and watch it work.

I’d like to say it is more complicated than this, but it isn’t.

A video version of this tutorial can be seen below.

Nic Raboy

Nic Raboy

Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in C#, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Unity. Nic writes about his development experiences related to making web and mobile development easier to understand.