a. Project walkthrough

Configurations

In File Explorer, Finder, or a Terminal, locate the directory which is root of the project (gdk-for-unity-blank-project).

Launch deployment

Here there are launch configurations: one for local deployments (default_launch.json) and one for cloud deployments (cloud_launch.json).

The directories look like this:

    gdk-for-unity-blank-project/
        ├── snapshots/
        ├── workers/
        ├── cloud_launch.json
        ├── default_launch.json
        ├── spatialos.json

These configurations are used to determine what template your deployment uses, the world size, the load balancing policies, and some worker-specific configuration parameters.

Snapshot
The snapshots directory contains a default snapshot (default.snapshot) defining the initial state of your game world.

The directories and files look like this:

    gdk-for-unity-blank-project/
        ├── snapshots/
                ├── default.snapshot
                   ...

Worker configuration

You can find the root of the Unity project in workers/unity/.

Here, you will find the client-worker and server-worker configurations. They are used to configure how a worker should be launched and specify particular Runtime settings for the given worker type.

The directories and files look like this:

    gdk-for-unity-blank-project/
        ...
        ├── workers/
            ├── unity/
                ├── Assets/
                ├── Packages/
                ├── ProjectSettings/
                ├── spatialos.UnityClient.worker.json
                ├── spatialos.UnityGameLogic.worker.json
        ...

Worker assets

Under Assets/Config/ of the Unity Project, there is a BuildConfiguration asset.

The directories and files look like this:

    Assets/
        ├── Config/
            ├── <b><font color="white">BuildConfiguration.asset</font></b>
            ...

This asset defines for each worker type the target platforms to build and which Scenes to include. By default the GDK builds both Windows and MacOS UnityClients for cloud deployments, but only build a single platform (Windows or MacOS depending on your machine) for local deployments. This is because you will only ever run a client for local deployments on your machine, but may want to distribute your game to both Windows and MacOS users when running a cloud deployment.

See the links below for more information:

Open the project

Open the Unity Project found at workers/unity/. The first time you open the project, Unity will retrieve all the packages defined in the manifest.json and cache them on your machine. After resolving the packages, you’ll see a popup that says Generating code.

Image: Unity generates Unity project code the first time you open the project in the Editor.

Scenes

You may have noticed that there are a set of Scenes present at Assets/Scenes/.

The ClientScene contains a ClientWorker prefab to represent a client-worker and similarly the GameLogicScene contains a GameLogicWorker prefab to represent a server-side worker. By playing either of these Scenes, these prefabs will try to connect their respective client-worker or server-worker to your SpatialOS deployment.

    ClientScene
        ├── ClientWorker

    DevelopmentScene
        ├── ClientWorker
        ├── GameLogicWorker

    GameLogicScene
        ├── GameLogicWorker

The GDK also allows you to run more than one worker in your Unity Editor. The DevelopmentScene contains both ClientWorker and GameLogicWorker prefabs, which in turn runs both a client-worker and a server-worker side-by-side in your Editor. By running both workers you don’t need to build out workers with every new change. This greatly speeds up local iteration times, as you’ll discover later on in this tutorial.

Packages and assembly definitions

Within your Unity Project there is a Packages/manifest.json file, which defines all the package dependencies of your project. The Blank Project includes dependencies to all Feature Modules, to make it easier to adopt and include them in your user code.

    unity/
        ├── Assets/
            ├── <b><font color="white">BlankProject.asmdef</font></b>
            ...
        ├── Packages/
            ├── <b><font color="white">manifest.json</font></b>
            ...

There is also a BlankProject assembly definition in your project’s Assets folder. Although the project manifest.json defines dependencies to all GDK Feature Modules, only the Core and Player Lifecycle modules are referenced in the assembly definition. This is because the Blank Project has minimal game code, and only makes use of the Player Lifecycle module. You can read more about assembly definitions here.

Updated about a year ago



a. Project walkthrough


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.