Publish Builds in Unity ECS
Workflow for deploying project using Unity's new Build Configurations

What you'll develop on this page

Run the project from a Build Configuration file
We will be able to deploy our project using Unity's new build pipeline.

Creating a build configuration

First, some background:

Before DOTS, the way to build a project was to go to "File" and choose "Build Settings" and set up the build.
Non-DOTS process to build the project
But now with SubScenes, this process no longer works. We need to create Build Configurations and build our projects from there. This is because we are using a new build pipeline built for DOTS projects. The previous method is for MonoBehaviour projects. We will be using a hybrid approach, but because we use DOTS, we must use this new build process.
Demonstrating the option to create an "Empty Build Configuration"
These Build Configurations have some great benefits where you can define a "base" Build Configuration, and have platform specific builds inherit from the base build. So if you add a new scene to your project, rather than having to add the new scene to every Build Configuration for each platform, you can add the new scene to your "base" Build Configuration and it will be included in each inherited Build Configuration.
  • We are going to add 3 new lines to our package manifest
"com.unity.platforms.linux": "0.10.0-preview.10",
"com.unity.platforms.macos": "0.10.0-preview.10",
"": "0.10.0-preview.10",
  • We could add these packages one by one through the Package Manager window, but for the sake of efficiency we choose to paste those 3 lines directly into manifest.json to add all 3 at once
  • We can now see new options to create Build Configurations
Adding the 3 platform packages to our manifest.json
Now the new Build Configuration options are visible under "Build"
  • Create a BuildSettings folder with in the Assets folder
  • Navigate to the BuildSettings folder and create an "Empty Build Configuration" and name it "Base"
    • This is the "base" Build Configuration that platform-specific builds will inherit from
  • Add a "General Settings" component to Base
    • In General Settings, update the Company Name and Product Name fields
  • And a "Scene List" component
    • Drop down the Scene Infos menu and click "Add Element"
    • Drag in SampleScene into the Scene field under Element name, and check Auto Load
  • Hit "apply" to save the changes
Creating BuildSettings folder and the Base Build Configuration
  • Now right click in BuildSettings, choose "create", then "Build", then either "macOS Classic Build Configuration" or "Windows Classic Build Configuration" depending on your development environment
    • Both of these will work, we have tested on windows as well
  • Select the newly created Build Configuration and remove the "General Settings" and "Scene List" components from the Inspector (this can also be accomplished by selecting "Remove Overrides" in more recent versions of Unity Editor)
    • If we keep these components they will override the inherited Base "General Settings" and "Scene List" and you won't be able to inherit those values from Base
    • You will get errors as you navigate around Build Configuration files but you can ignore them (just classic preview packages!)
  • Click "+ Add Configuration" under Shared Configurations at the top of the Inspector than drag "Base" into the Shared Configuration field (drag gently, so that macOS Build Configuration stays selected). Please note: "Base" may already be there in more recent versions of Unity Editor.
  • You will see that we have inherited the General Settings and Scene List from Base
  • Hit "apply" at the bottom of Inspector and then click "Build and Run" at the top of the Inspector
  • If you get an error message, it might be because some Overrides haven't been removed. Removing the override fixes the error
  • If you get a different error message (not one related to Overrides), try using the "File > Build and Run" menu option instead of the Build Settings > {OS} Build > Build and Run" option
Creating our MacOS Build Configuration then hitting Build and Run
Our built project
  • Great, now we know how to build a Base Build Configuration and inherit to platform-specific Builds
  • Rather than having to make these ourselves for each and every platform, let's instead grab all the pre-made Build Configurations that Unity has created
  • Delete our "Base" and MacOS/Windows Build Configuration from our Build Settings folder and replace them with our downloaded Build Configurations
    • Download each of the Build Configuration files in Unity's EntityComponentSystemSamples repo by cloning the repo or downloading a zip, etc. and dragging the files into the BuildSettings folder in your Project folder
      • FYI: If you downloaded the full Unity ECS Samples repo, the BuildConfigurations files are under ECSSamples > Assets > BuildConfigurations
  • Update the Product Name and Company Name fields in "BaseBuildConfiguration" General Settings and drag in SampleScene to Scene under Scene List
  • Now select a build configuration for your development platform
    • If you are developing on Mac you would choose "macOS-Build"
    • Click "+ Add Configuration" under Shared Configurations at the top of the Inspector
    • Drag "BaseBuildConfiguration" into the Shared Configuration field (drag gently, so that macOS-Build stays selected)
      • You will see that we have inherited the General Settings and Scene List from Base
      • Hit "apply" at the bottom of Inspector and then click "Build and Run" at the top of the Inspector
  • Hit "Build and Run" in Inspector
    • The first time you hit build and run you may encounter an error, don't worry that is Unity getting ready to build, hit it again and you will be set
Updating to Unity's sample Build Configurations
Running our project built from Unity's sample Build Configurations
We can now build for specific target platforms
  • We created a BuildSettings folder in Assets and added Build Configurations
  • We updated our Base Build Configuration and applied so all platform-specific Build Configurations would be updated
git clone git checkout 'Building-the-Project'