-
Notifications
You must be signed in to change notification settings - Fork 18
UMake
UMake is an extensible build system for Unity. It allows you to configure recipes for several targets (Windows, WebGL, etc) and build them at any time with the push of a button.
- UMake scriptable object
- UMake targets (recipes)
- Pre and Post build actions
- Command line interface
The UMake (UMake.cs
) scriptable object is the centralized place where you can see all your build targets.
You'll find it at Assets/BitStrap/Plugins/UMake/Editor/UMake.asset
. Alternatively, select it by pressing
ctrl+alt+b
(command+alt+b
on Mac). There you'll find a collection of all your UMake targets.
By the side of each, there are shortcuts to execute its actions. We'll get there in a bit.
Also, there you can choose your Build Path
, a folder where all builds made are found. It's a good idea to
configure one to prevent UMake from asking for a build folder every time you hit build. Also, if you plan to
use it form the command line, the build path is required.
Version
is the current build version string. You can use whatever format you want here. The idea is to
uniquely identify different builds.
Build targets (UMakeBuildTarget.cs
) are like recipes of how to make a specific build. That could be
Windows 32bits Itch, Windows 64bits Steam, Mac Development, Mac Production, WebGL, and so
on. It's up to you how to organize your build targets.
There are a few things here to note.
Build Target
is the Unity build target. Choose if you want to target Windows, Mac or even Android.
Build Options
are some Unity options you can choose for your build. Learn more about them
here.
File Name Override
, if not empty, will change the final executable name. There are two variables you can use:
-
{TARGET}
will expand to this UMake target name -
{VERSION}
will expand to the build version you set in the UMake asset
Open Folder
will open this target's build folder (the one inside the build path you setup in UMake scriptable
object).
Pre Actions
will execute this target's pre build actions.
Build
will first execute this target's pre build actions and then build it.
Post Actions
will execute this target's post build actions.
Here is the extensible part of UMake. These are actions that are performed before or after the build given in
which list they are. Build actions can be anything you want. A couple of examples are
IncrementVersionBuildAction
that will increment the version present in UMake and SteamUploadBuildAction
that
will upload the executable to Steam.
You can put here any custom script you want. Say that, in this target, you need to change the url of your backend to production. You'd create a new build action that would have a reference to your backend prefab and then, on execute, change the url in the prefab.
It's possible to invoke UMake features from the command line. Unity has support for calling a static method from the command line with the -executeMethod <ClassName.MethodName>
param (unity documentation). In our case, it'd be -executeMethod BitStrap.UMakeCli.<CliMethod>
. For any of these methods, you can pass parameters to them by appending a series of paramName:paramValue
args to the Unity Cli call.
NOTE: neither paramName
nor paramValue
can have white spaces in them!!
Also, if you have custom build actions that you'd like to get custom params from the Cli, just append the params as normal and you can access them with Args.Get( paramName )
.
Possible Cli methods:
-
BitStrap.UMakeCli.Build
-
target
: which UMake target (recipe) will be built (remember that building a target also executes its pre build actions) -
buildPath
: where the build will be located
-
-
BitStrap.UMakeCli.PreActions
-
target
: from which UMake target (recipe) it will execute pre build actions
-
-
BitStrap.UMakeCli.PostActions
-
target
: from which UMake target (recipe) it will execute post build actions
-
A build action is a simple ScriptableObject
. Create a script that inherits from UMakeBuildAction
and
override the method Execute()
.
public virtual void Execute( UMake umake, UMakeTarget target )
There you can put whatever code that should execute as a pre or post build action. Once you have your build
action script, create an instance of it by right-clicking the script and selecting
Create > Scriptable Object Instance
. Now you can add this asset to your build target pre/post build actions
and it will execute accordingly.
- UMake
- WebApi
- AnimationUtilities
- EditorGraph
- RuntimeConsole
- Editor Tools
- BehaviourButton
- Isolate
- Custom Editors and Property Drawers
- Tween
- Util