Nebula
Editor

NebulaSetup

Adds the components and settings required to use Nebula in the active scene.

generated from the sources
Static class in namespace Nebula.Editor · Packages/com.1by3.nebula/Editor/NebulaSetup.cs
public static class NebulaSetup

Adds the components and settings required to use Nebula in the active scene. The setup creates the Resources/NebulaConfig asset and a Nebula object with NebulaBootstrap, NebulaDebugOverlay, and NebulaTitleScreen. It also configures the game scene, build settings, game mode, starter Container volumes, and networked prefabs. Run the setup again to restore missing configuration.

Fields

ConfigAssetPath

public const string ConfigAssetPath = "Assets/Resources/NebulaConfig.asset";

DocsUrl

public const string DocsUrl = "https://nebula.1by3.co/docs";

SplitThreshold

public const float SplitThreshold = 40f;

A container footprint at least this long on an axis is split in two along it by the scene setup.

Methods

SetUpActiveSceneMenu

[MenuItem("Nebula/Set Up Active Scene", priority = -100)]
public static void SetUpActiveSceneMenu();

SelectConfig

[MenuItem("Nebula/Select Config", priority = -80)]
public static void SelectConfig();

OpenDocumentation

[MenuItem("Nebula/Documentation", priority = 200)]
public static void OpenDocumentation();

RegisterNetworkPrefabsMenu

[MenuItem("Nebula/Network Prefabs/Register All Network Prefabs", priority = 60)]
public static void RegisterNetworkPrefabsMenu();

SplitSelectedMenu

[MenuItem("Nebula/Containers/Split Selected Container (2x2)", priority = 50)]
public static void SplitSelectedMenu();

CreateContainerMenu

[MenuItem("GameObject/Nebula/Container", priority = 10)]
public static void CreateContainerMenu(MenuCommand command);

CreateBootstrapMenu

[MenuItem("GameObject/Nebula/Bootstrap", priority = 11)]
public static void CreateBootstrapMenu();

SetUpActiveScene

public static Report SetUpActiveScene(bool createContainers);

Configure the active scene as the game scene (see the class summary). Returns null when the scene cannot be set up (a cell scene, or an untitled scene the user declined to save).

ReportConfigIssues

public static void ReportConfigIssues(NebulaConfig config, Report report);

Add every NebulaConfig.Validate issue to report, so a setup pass says "your interest radius does not fit in your load radius; it was raised" in the same dialog as everything else it did, instead of leaving it to a warning nobody reads at run time.

EnsureConfig

public static NebulaConfig EnsureConfig(Report report);

The config every role loads (Resources/NebulaConfig), created at ConfigAssetPath if missing.

FindConfig

public static NebulaConfig FindConfig();

The asset NebulaConfig.Load returns at runtime, or null.

EnsureBootstrap

public static NebulaBootstrap EnsureBootstrap(Scene scene, NebulaConfig config, Report report);

The scene's NebulaBootstrap (created on a root Nebula object if missing), wired to config, with a debug overlay and a title screen.

GameModeTypes

public static List<Type> GameModeTypes();

Concrete NebulaGameMode types in player (non-editor, non-test) assemblies.

LevelBounds

public static Bounds LevelBounds(Scene scene);

Union of the renderer and collider bounds in the scene; a 40 m square at the origin for an empty scene.

Split

public static List<Container> Split(Container container, int nx, int nz);

Replace container with nx x nz containers tiling its footprint (same parent, rotation, scale and height), ids <id>-x-z. Undoable. A container with children is left alone.

UniqueContainerId

public static string UniqueContainerId(string wanted, Container ignore = null);

wanted, or wanted-2, wanted-3... so no container in the open scenes (other than ignore) has it.

RegisterNetworkPrefabs

public static int RegisterNetworkPrefabs(NebulaConfig config, Report report);

Append every prefab under Assets whose root has a NetworkIdentity and is not yet listed to NebulaConfig.NetworkPrefabs. Existing entries are never reordered or removed: the index is the prefab id on the wire. Returns how many were added.

NetworkPrefabCandidates

public static List<GameObject> NetworkPrefabCandidates();

Prefab assets under Assets whose root carries a NetworkIdentity.

FindInScene

public static List<T> FindInScene<T>(Scene scene)
    where T : Component;

Every T in a loaded scene, inactive objects included.

SceneContains

public static bool SceneContains<T>(string scenePath)
    where T : Component;

Whether the scene at scenePath uses a T (read from the open scene, else from its file's dependencies).

ScriptPathOf

public static string ScriptPathOf(Type type);

Project path of the script defining type, or null.

FindScenePath

public static string FindScenePath(string sceneName);

Project path of the scene asset named sceneName (build settings first), or null.

Show

public static void Show(string title, Report report);

Log a report and summarise it in a dialog (the log only, in batchmode).

Nested types

Report

public sealed class Report

What a setup pass did, and what it could not do for you.

Fields

Done
public readonly List<string> Done = new List<string>();
Warnings
public readonly List<string> Warnings = new List<string>();

Methods

Did
public void Did(string line);
Warn
public void Warn(string line);

On this page