Awesome
UniBuild
Command based scriptable build pipeline for Unity 3D
Getting Started
Unity Package Installation
Odin Inspector or Tri-Inspector recommended to usage with this Package (https://odininspector.com | https://github.com/codewriter-packages/Tri-Inspector)
Add to your project manifiest by path [%UnityProject%]/Packages/manifiest.json these lines:
{
"dependencies": {
"com.unigame.unibuildpipeline": "https://github.com/UnioGame/UniGame.UniBuild.git",
"com.unigame.coremodules": "https://github.com/UnioGame/UniGame.CoreModules.git",
"com.cysharp.unitask" : "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
}
}
Build Pipeline
Menu Items
All Build menu items auto-generated by your build configurations
All exists build pipeline configurations window
Auto generated content stored in: "Assets\UniGame.Generated\UniBuild\Editor"
Unity Cloud Build Methods
All Cloud methods auto-generated by your build configurations files
Build Console Arguments
Buildin pipeline ci arguments
"-gitBranch"
git branch value of build: -gitBranch:develop
-buildOptions
unity build options - https://docs.unity3d.com/ScriptReference/BuildOptions.html. **-buildOptions:Development,AutoRunPlayer,CleanBuildCache**
"-bundleVersion"
allow to setup application bundle version shared between iOS & Android platforms. -bundleVersion:"0.0.1"
"-buildNumber"
CI build number: -buildnumber:1000
"-outputFileName"
Output artifact file name: -outputFileName:demo.exe
"-outputFolder"
Output folder location: -outputFolder:Builds
"-bundleId"
setup PlayerSettings.applicationIdentifier. -bundleId:"com.some.app.id"
"-buildTarget"
Unity Build Target value from BuildTarget enum
"-buildTargeGroupt"
BuildTargetGroup enum value
"-standaloneBuildSubtarget"
"-buildLinux64Player"
"-buildOSXUniversalPlayer"
"-buildWindows64Player"
"-scriptingImplementation"
Values from https://docs.unity3d.com/ScriptReference/ScriptingImplementation.html. Mono2x, IL2CPP
"-buildEnvironmentType"
value from: Custom, UnityCloudBuild; Custom by default
"-developmentBuild";
enable development build mode
"-autoconnectProfiler";
enable profiler connect on launch
"-deepProfiling";
activate deep profiling
"-scriptDebugging";
allow to debug scripts
Custom CI argumetns
Custom build console arguments can be handled in pipeline commands and obtained through the API available to each command.
Demo Arguments Command
[Serializable]
public class DemoBuildCommand : SerializableBuildCommand
{
public string demoIntArgument = "-demoIntValue";
public string demoBoolArgument = "-demoBoolValue";
public string demoEnumArgument = "-demoEnumValue";
public int defaultIntValue = 100;
public override void Execute(IUniBuilderConfiguration buildParameters)
{
var arguments = buildParameters.Arguments;
var intExists = arguments
.GetIntValue(demoIntArgument,out var argumentIntValue, defaultIntValue);
var boolExists = arguments
.GetBoolValue(demoBoolArgument,out var boolValue, false);
var enumExists = arguments
.GetEnumValue(demoEnumArgument,typeof(DemoArgEnum),out DemoArgEnum enumValue);
//set value of argument all other commands after this will use this value
arguments.SetValue(demoIntArgument, argumentIntValue.ToString());
}
public enum DemoArgEnum
{
None,
Value1,
Value2,
}
}
public interface IUniBuilderConfiguration
{
/// <summary>
/// Allow to use local argument data between build steps
/// </summary>
IArgumentsProvider Arguments { get; }
/// <summary>
/// Current Unity build parameters
/// </summary>
BuildParameters BuildParameters { get; }
/// <summary>
/// Build report data, use only after build process
/// </summary>
BuildReport BuildReport { get; set; }
}
ArgumentsProvider API
public interface IArgumentsProvider
{
List<string> SourceArguments { get; }
IReadOnlyDictionary<string, string> Arguments { get; }
string EvaluateValue(string expression);
void SetArgument(string key, string value);
void SetValue(string key, string value);
bool GetIntValue(string name, out int result, int defaultValue = 0);
bool GetBoolValue(string name, out bool result, bool defaultValue = false);
bool Contains(string name);
bool GetEnumValue<TEnum>(string parameterName,out TEnum result) where TEnum : struct;
bool GetEnumValue<TEnum>(string parameterName,Type enumType, out TEnum result) where TEnum : struct;
bool GetStringValue(string name, out string result,string defaultValue = "");
}
Commands
All build commands realize common API:
- IUnityBuildCommand
For simplification, you can implement one of the ready-made templates:
- SerializableBuildCommand
- UnityBuildCommand (Scriptable Object Template)
You can create your own command with two ways:
- Unity ScriptableObject command
In that case inherit your SO from - UnityBuildCommand . Scriptable Object Commands can be helpful when you want to share command between different pipelines and modify command parameters from single source
- Serializable Regular C# class
If you choose this way, then just realise Interface API - IUnityBuildCommand , no addition actions required
Additional commands
Some "ready to use" commands can be found at "UniGame Build Commands" package
https://github.com/UnioGame/UnioGame.UniBuildCommands
- AddressableImporter Package commands (https://github.com/favoyang/unity-addressable-importer)
- Unity Addressables Commands (FTP upload support, Rebuild e.t.c)
- WebRequests Commands
- Folder & File commands
- FTP commands