(v0.50) DOTS Tutorial - Build a Multiplayer AR app
  • What is the Purpose of this DOTS Tutorial?
  • Important Notes For Using This Gitbook
  • Unity ECS
    • Intro to Unity ECS
    • Create a Unity ECS Project
    • Spawn and Move Prefabs
    • Spawn and Move Players
    • Spawn Bullets and Destroy Player
    • Publish Builds in Unity ECS
  • Unity DOTS Physics
    • Intro to Unity DOTS Physics
    • Use DOTS Physics for Prefabs, Players, and Bullets
    • Use DOTS Physics for Collisions
  • Unity DOTS NetCode
    • Intro to DOTS NetCode
    • Create a Network Connection using DOTS NetCode
    • Load a Game using DOTS NetCode
    • DOTS NetCode and Prefabs
    • DOTS NetCode and Player Prefabs
    • Use DOTS NetCode for Collisions and Destroying Bullet Prefabs
    • Dynamically Changing Ghosts Between Interpolated and Predicted
  • UI Builder and UI Toolkit
    • Intro to UI Toolkit
    • Create a ScreenManager
    • Style a View
    • Create a ListView
    • Responsive Game UI
    • Navigate Between Scenes Using ClientServerBootstrap
  • Multiplayer (NetCode+, UI Toolkit+)
    • Intro to Unity NetCode Multiplayer
    • Host or Join a Multiplayer Session on LAN
    • Broadcast a LAN Multiplayer Game
    • Keep Score and Update Game UI
    • Send Ghosts with NetCode Using Relevancy
  • AR Foundation
    • Intro to AR Foundation
    • Set Up AR Foundation and ARKit
    • Spawn a Player using AR Foundation
    • Update UI using AR Foundation
Powered by GitBook
On this page
  • What you'll develop on this page
  • Creating a build configuration
  1. Unity ECS

Publish Builds in Unity ECS

Workflow for deploying project using Unity's new Build Configurations

PreviousSpawn Bullets and Destroy PlayerNextIntro to Unity DOTS Physics

Last updated 2 years ago

What you'll develop on this page

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.

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.

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 a new line to our package manifest

"com.unity.platforms": "0.50.0-preview.4",
  • We can now see new options to create Build Configurations when we right-click and hit "create"

  • 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

This is our "base" information that we will apply to all different builds for different platforms. (We promise that will make sense in a second).

  • Now right click in /BuildSettings, choose "create", then "Build" and create a new "Empty Build Configuration"

    • Name it "Windows" or "MacOS" based on your development environment

  • Select the newly created Build Configuration and click "Add Component", select "Classic Build Profile" and choose Windows/Mac from the dropdown

  • Click "+ Add Configuration" under Shared Configurations at the top of the Inspector than drag "Base" into the Shared Configuration field

  • 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

  • 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

      • 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

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 https://github.com/moetsi/Unity-DOTS-Multiplayer-XR-Sample/ git checkout 'Building-the-Project'

Github branch link:

Download each of the Build Configuration files in by cloning the repo or downloading a zip, etc. and dragging the files into the BuildSettings folder in your Project folder

Github branch link:

https://github.com/moetsi/Unity-DOTS-Multiplayer-XR-Sample/tree/Building-the-Project/
Join our Discord for more info
Unity's EntityComponentSystemSamples repo
https://github.com/moetsi/Unity-DOTS-Multiplayer-XR-Sample/tree/Building-the-Project/
Join our Discord for more info
Run the project from a Build Configuration file
Non-DOTS process to build the project
Demonstrating the option to create an "Empty Build Configuration"
Adding the platform package to our manifest.json
Now the new Build Configuration options are visible under "Build"
Creating BuildSettings folder and the Base Build Configuration
Creating our MacOS Build Configuration then hitting Build and Run
Our built project
Updating to Unity's sample Build Configurations
Running our project built from Unity's sample Build Configurations