Custom build systems
If you're using a custom build system for making builds in Unity, this is for you.
This article is only relevant to you if you are using a custom solution for making builds in Unity. It is not a required step for getting started with Trail.
Integrating a custom build system with Trail
You can use this to trigger your own build system when pressing any of the "Build" buttons in the Trail Editor Extension.
This is not a requirement for making builds for Trail, it's simply a convenience.
Events | Description |
---|---|
| The event that can be used to override the default build pipeline used by Trail. The method provided needs to return a BuildReport, so Trail can store information about the build for easier uploading. |
| The event that that can be used to run any custom code before a build. |
Example:
[InitializeOnLoadMethod]
private static void SetupBuildPipeline()
{
Trail.TrailBuild.CustomBuild += MyBuildPipeline;
}
private static BuildReport MyBuildPipeline()
{
BuildPlayerOptions options = new BuildPlayerOptions();
options.scenes = EditorBuildSettings.scenes
.Where(x => x.enabled)
.Select(x => x.path)
.ToArray();
options.target = BuildTarget.WebGL;
options.targetGroup = BuildTargetGroup.WebGL;
options.options = BuildOptions.ShowBuiltPlayer;
options.locationPathName = "Builds/WebGL";
return UnityEditor.BuildPipeline.BuildPlayer(options);
}
Triggering builds and uploads programmatically
Useful for example if you want to finish your scripted build process with uploading the build to Trail.
Method | Description |
---|---|
| This method will run through all the reports in |
| This method will run the same operation as the |
| This method will attempt to upload the latest build, with a description, to Trail if any build exists. |
| This method will attempt to upload a build, with a description, on the provided path to Trail. |
| A convenient method to verify if the build cache exists and the directory of the build exists. |
Example:
private static void ExampleBuildAndUpload()
{
var requiredIssues = Trail.TrailBuild.RunFullReport();
if (requiredIssues > 0)
{
Debug.LogError($"You have {requiredIssues} that needs to be fixed before building for Trail.");
return;
}
var report = Trail.TrailBuild.Build();
if (report.summary.result == BuildResult.Succeeded)
{
Trail.TrailBuild.Upload();
}
}
Updated 6 months ago