Get SpatialOS

Sites

Menu
You are viewing the docs for 11.0, an old version of SpatialOS. 12.0 is the newest →

Deploying locally

After setting up your project, you can deploy locally.

For information about deploying to the cloud, see Deploying to the cloud.

Deploy from the command line

To deploy from the command line:

  1. Open a terminal and navigate (cd) to the root directory of your project.
  2. If you have a default launch configuration file (default_launch.json), run the command:

    spatial local launch
    

    Alternatively, run

    spatial local launch <launch configuration>
    

    where

    • launch configuration specifies the launch configuration file you want to use. For example, development.json. For information about this file, see the launch configuration page.

    Run spatial local launch --help for more information.

When SpatialOS starts successfully, you should see SpatialOS ready in the console. At this point, you can access the Inspector at http://localhost:21000/inspector and connect clients.

Deploy from Unity

  1. In the Unity Editor, open the SpatialOS window (Window > SpatialOS).
  2. Under Run SpatialOS locally, click Run.

    This opens a console running spatial local launch.

When SpatialOS starts successfully, you should see SpatialOS ready in the console. At this point, you can access the Inspector at http://localhost:21000/inspector.

Connect a client

Connect a client from Unity

Once the deployment is running, to connect a Unity client:

  1. In Unity, open workers/unity (or the directory that contain the Unity client), and open the scene UnityClient.unity.

    UnityClient scene in Unity assets

  2. At the top, click Play ▶.

    The scene will open, looking something like this:

    Open scene in Unity

Connect clients (and other workers) from the command line

You can connect any type of worker to a local deployment from the command line.

To do this, use:

spatial local worker launch <worker type> <launch_config>

where:

  • worker type: the type of the worker. For example, UnityClient.
  • launch_config: the launch configuration file.

Run spatial local worker launch --help for more information.

For example, to start a UnityClient using the default launch configuration, run

spatial local worker launch UnityClient default

When successful, you will see the new Unity client worker at http://localhost:21000/inspector.

Stop a local deployment

When spatial local launch is running, use Ctrl + C to stop it.

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums