Appearance
Appearance
The Metaplay SDK uses client build version information for the following purposes:
The SDK exposes the current build version information via MetaplaySDK.BuildVersion
if you'd like to use it for anything else, such as including it on the splash screen in development builds or including it in bug reporter tools.
The client build version information is declared in the BuildVersion.cs
class and consists of the following members:
Version
- Typically, this is the application version information obtained from Unity Application.version
, but it can be overridden with your custom versioning scheme.CommitId
- This is the unique identifier of the source code version that the client was built from, most commonly a git sha1.BuildNumber
- An identifier for a particular build in your build system / CI.All fields of the client build version information are completely optional, but populating the fields in builds will be helpful when trying to isolate issues in the future.
The Metaplay Unity SDK contains a build preprocessor script that reads data the from command line and environment values and bakes them into the built application. Using this utility, setting values for the client build CommitId
and BuildVersion
is as simple as either passing in the values to the Unity editor invocation of the build or setting the appropriate environment variables for the given environment.
To set the CommitId
, add command line option -MetaplayCommitId={commit}
to the Unity build invocation.
To set the BuildNumber
, add command line option -MetaplayBuildNumber={buildNumber}
to the Unity build invocation.
If you invoke the client build using the game-ci unity-builder Github Action, this is how to set the values:
- name: Build client
uses: game-ci/unity-builder@v4
with:
customParameters: -MetaplayCommitId=${{ github.sha }} -MetaplayBuildNumber=${{ github.run_number }}
To set the CommitId
, set environment variable METAPLAY_COMMITID
to the desired value.
To set the BuildNumber
, set environment variable METAPLAY_BUILDNUMBER
to the desired value.
For GitHub Actions, this is what it might look like :
- name: Build client
env:
METAPLAY_COMMITID: ${{ github.sha }}
METAPLAY_BUILDNUMBER: ${{ github.run_number }}
The values set during the build using the mechanism above are only used if they are not overridden by programmatic configuration in your client. To use your custom scheme to populate these values, pass in an instance of BuildVersion
to the MetaplayClient.Initialize()
initialization function in the AppInfoOptions.BuildVersion
member of the options
argument. Note that the fields of BuildVersion
can be overridden partially, and passing in null
as the value of a field will cause the build process to attempt to use the value from the command line or environment for that field.