Build Versions Scripting Reference

Scripting

Namespace

All code for this asset is under the following namespace(s):

// Normal code the user will need
CarterGames.Assets.BuildVersions
// Editor code
CarterGames.Assets.BuildVersions.Editor
Scripting

Classes

Build Information

Properties

BuildNumber

Gets the current build number, this is the unique number not the player settings number.
Returns: Int

BuildDate

Gets the date that the last build was made as a string.
Returns: String

BuildType

Gets the “type” the build is set as by you.
Returns: Int

BuildNumber

Gets the systematic version in the player settings.
Returns: String

Scripting

Examples

You can use the build information asset to display the current build information in your game should you wish. Below is an example of a TextMeshPro UI display to show the current build number & date.

[SerializeField] private BuildInformation buildInformation;
private TMP_Text displayText;
private void Awake()
{
    displayText = GetComponent<TMP_Text>();
    displayText.text = $"Build: {buildInformation.BuildNumber} ({buildInformation.BuildDate})";
}

Below is another example in a different formatting and coding style.

private readonly string DatePrefix = "Date:";
private readonly string BuildPrefix = "Build:";
        
private TMP_Text buildText;
public BuildInformation buildInformation;
private void Awake()
{
    buildText = GetComponent<TMP_Text>();
    UpdateBuildText();
}
private void UpdateBuildText()
{
    var _string = string.Empty;
    _string += $"{DatePrefix} {buildInformation.BuildDate}\\n";
    _string += $"{BuildPrefix} {buildInformation.BuildNumber} ({buildInformation.BuildType})";
    buildText.text = _string;
}