Get started: 3 - Build your workers
As you will be launching a cloud deployment, you need to build out the code executables which will be run by SpatialOS servers - these are called workers.
- You first need to make sure Burst compilation is set to disabled; in your Unity Editor, navigate to Jobs > Enable Burst Compilation and select disabled.
- Now you can build your workers from the SpatialOS menu by selecting Build for cloud > All workers.
The SpatialOS menu in the Unity Editor
NOTE: Building workers for the first time may take a while (about 10 minutes). Why not make yourself a cup of tea or check out our Youtube channel while you wait?
- It has finished building when: You see the following message in the Unity Editor’s Console window:
Completed build for Cloud target.
TIP: You may get a number of warnings displayed in the Unity Editor Console window. You can ignore the warnings at this stage; use the message icons on the right-hand side of the Console window to set it to display only info and error messages so you can see only the relevant messages.
If you encounter build errors:
You might not have selected the build supports your game needs during your Unity setup.
- You need Linux build support. This is because server-workers in a cloud deployment always run in a Linux environment. In the
Assets/Fps/Config/BuildConfiguration, do not change the
UnityGameLogic Cloud Environmentfrom Linux.
- You need Mac build support if you are developing on a Windows PC and want to share your game with Mac users.
- You need Windows build support if you are developing on a Mac and want to share your game with Windows PC users.
- Unity gives you build support for your development machine (Windows or Mac) by default.
After the build has successfully finished:
gdk-for-unity-fps-starter-project/build/assembly folder should contain:
worker ├── SimulatedPlayerCoordinator@Linux.zip ├── UnityClient@Mac.zip ├── UnityClient@Windows.zip ├── UnityGameLogic@Linux.zip
TIP: Speed up development iteration with worker quick-run
When you are developing with the GDK, you don’t need to build out workers all the time, you can use quick-run to run multiple workers in your Unity Editor using Ctrl+L (Windows) or Cmd+L (Mac).
This tutorial takes you through the steps to set up a cloud deployment. When you are developing with the GDK, you use a local deployment rather than a cloud deployment. In a local deployment, you can either build your workers to run locally or use quick-run. With quick-run you can run multiple workers in your Unity Editor, so you don’t have to keep building out workers during development iteration.
To use quick-run with the FPS Starter Project:
1. With your project open in the Unity Editor, on your computer’s keyboard, select Ctrl+L (Windows) or Cmd+L (Mac).
2. Wait until you see a message in the Editor’s Console window that SpatialOS is ready. The message is: SpatialOS ready. Access the inspector at http://localhost:21000/inspector.
3. In your Unity Editor, play the FPS-Development Scene.