Nebula
Bootstrap

NebulaBootstrap

Entry point for Unity workers and clients.

generated from the sources
[DefaultExecutionOrder(-1000)]
public sealed class NebulaBootstrap : MonoBehaviour

Entry point for Unity workers and clients. Put one in the boot scene. Reads the role from the command line (-nebula-role worker,gateway) or from EditorRole when running in the Editor, loads the game scene, and starts the matching components. A process is a worker or a client, never both. With NebulaConfig.EditorRunMode set to NebulaEditorRunMode.MultiplayerPlayMode, the Editor needs no build: a Multiplayer Play Mode virtual player is the server process and the main Editor is the client. The CLI launches standalone .NET orchestrator and gateway executables; Unity service roles remain available for compatibility and in-process tests.

  • -nebula-role client|worker|gateway|orchestrator (comma separated)
  • -nebula-worker-id w1 -nebula-worker-index 1 -nebula-port 7101
  • -nebula-gateway 127.0.0.1:7000
  • -nebula-control-plane http://10.0.1.2:7080/ -nebula-token secret (worker, gateway: the orchestrator that hosts the control plane)
  • -nebula-database file:saves|memory (Unity orchestrator: where the control plane and saved entities are kept; the standalone orchestrator also takes sqlite: and postgres://)
  • -nebula-persistence-mode auto|database|remote|local|memory|off -nebula-persistence-file saves/world.bin (where persistent entities are stored)
  • -nebula-workers 4 -nebula-dashboard-port 7080 -nebula-settings round-time=600 (orchestrator; settings are game-defined key/values seeded on the control plane, editable on the dashboard)
  • -nebula-name Jesse (client display name)
  • -nebula-advertise 10.0.1.2|auto (address this worker/gateway advertises to peers)
  • -nebula-host process|hetzner|cloud -nebula-build-dir /opt/nebula/artifacts (orchestrator: where workers run; cloud hosts also read -nebula-cloud-location, -nebula-cloud-type, -nebula-cloud-image, -nebula-cloud-network, -nebula-cloud-sshkey, -nebula-cloud-firewall, -nebula-build-url, and the provider token from -nebula-cloud-token or HCLOUD_TOKEN)

Fields

EditorRole

public NebulaRoles EditorRole = NebulaRoles.Client;

Roles started when pressing Play in the Editor, in place of -nebula-role. It does not replace a build: the standalone orchestrator launches Unity workers and a .NET gateway, and a Unity process is never both a client and a worker, so whichever half the Editor does not run comes from a build. Client (the default) joins a mesh started with nebula start; Worker joins one started with nebula start --workers 0.

Config

public NebulaConfig Config;

Properties

Instance

public static NebulaBootstrap Instance { get; }

Roles

public NebulaRoles Roles { get; }

ControlPlane

public IControlPlane ControlPlane { get; }

PersistenceStore

public IPersistenceStore PersistenceStore { get; }

Where persistent entities are stored, created for the worker and orchestrator roles from NebulaConfig.PersistenceMode. Null when persistence is off.

SharedCacheStore

public ISharedCacheStore SharedCacheStore { get; }

Where the shared cache (NebulaSharedCache) keeps its objects when this process owns them: an orchestrator, or a process that is its own cache (the Editor, a single-process run). Null for a worker that asks the orchestrator, and when the shared cache is off. See NebulaConfig.SharedCacheMode.

Worker

public NebulaWorker Worker { get; }

Gateway

public NebulaGateway Gateway { get; }

Orchestrator

public NebulaOrchestrator Orchestrator { get; }

Client

public NebulaClient Client { get; }

WorldStreaming

public NebulaWorldStreaming WorldStreaming { get; }

Per-role cell streaming policy; null unless NebulaConfig.WorldManifest is set.

ChunkedWorld

public NebulaChunkedWorld ChunkedWorld { get; }

Per-role chunked-world policy; null unless NebulaConfig.ChunkedWorld is on with a NebulaConfig.RuntimeWorld.

RunPlan

public EditorRunPlan RunPlan { get; }

What this Editor process does under NebulaConfig.EditorRunMode: EditorPlayer.Mesh in a build, in NebulaEditorRunMode.Mesh, or when -nebula-role is given.

Methods

EnsureExists

public static NebulaBootstrap EnsureExists();

The prefab used for the boot scene's Nebula object when none exists (editor convenience).

On this page