RaptorLightBackends
The light backend registry.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
A placed light is edited through the backend that owns it (For). Only new placements, Liquid glows and rebuilds of a bare light use Active. The built-in Bakery backend is always registered first. A second Register with the same id is refused, so entering Play mode without a domain reload is safe.
public static class RaptorLightBackendsFields
AutoChoice
public const string AutoChoice;The setting's default value: Bakery when installed, otherwise the first available added backend, otherwise Unity.
BakeryId
public const string BakeryId;The built-in Bakery backend's id.
SettingKey
public const string SettingKey;The key of the Project Settings → RAPTOR → Lighting value, which holds AutoChoice or a backend id. Read only when Bakery is not installed; a missing settings file reads as Auto.
UnityId
public const string UnityId;The built-in Unity backend's id. This backend uses a Baked UnityEngine.Light and is used when Bakery is not installed.
Properties
Active
public static IRaptorLightBackend Active { get; }The backend used to place new lights: TestOverride if set, otherwise Auto. Never null.
All
public static IReadOnlyList<IRaptorLightBackend> All { get; }Every registered backend: the built-ins first (Bakery, Unity), then the rest in registration order.
Auto
public static IRaptorLightBackend Auto { get; }Bakery when it is installed; otherwise the backend the Lighting setting selects (Resolve), Unity by default. Never null.
SettingChoice
public static string SettingChoice { get; }The Lighting setting (SettingKey), or AutoChoice when unset.
Methods
For
public static IRaptorLightBackend For(RaptorLight light)Returns the backend that owns light, checking the override first, otherwise Active.
| Parameter | Type | Description |
|---|---|---|
light | RaptorLight | The light. |
Returns: The backend, never null.
ForObject
public static IRaptorLightBackend ForObject(GameObject go)Returns the backend whose light component go has, checking the override first, otherwise Active. Use it for objects that may have no RaptorLight, such as a Liquid glow.
| Parameter | Type | Description |
|---|---|---|
go | GameObject | The GameObject. |
Returns: The backend, never null.
Get
public static IRaptorLightBackend Get(string id)Returns the registered backend with this id, or null.
| Parameter | Type | Description |
|---|---|---|
id | string | The backend's id. |
Returns: The backend, or null.
Register
public static bool Register(IRaptorLightBackend backend)Adds a backend after the existing ones.
| Parameter | Type | Description |
|---|---|---|
backend | IRaptorLightBackend | The backend. |
Returns: False when the id is taken; the existing backend is kept.
Call from an [InitializeOnLoad] static constructor on the main thread.
Resolve
public static IRaptorLightBackend Resolve(bool bakeryPresent, string choice)The Auto rule as a pure function. With Bakery installed, returns Bakery regardless of the setting. Without Bakery, returns the backend the setting names if it is registered and available, otherwise the first available added backend, otherwise Unity.
| Parameter | Type | Description |
|---|---|---|
bakeryPresent | bool | Whether Bakery is installed. |
choice | string | The setting's value. |
Returns: The backend.
SettingChoices
public static List<string> SettingChoices(bool bakeryPresent)Returns the choices the Lighting setting offers: none when Bakery is installed, otherwise Auto, Unity and the id of every available added backend.
| Parameter | Type | Description |
|---|---|---|
bakeryPresent | bool | Whether Bakery is installed. |
Returns: The choices.
Unregister
public static bool Unregister(string id)Removes a registered backend. The built-in Bakery and Unity backends cannot be removed.
| Parameter | Type | Description |
|---|---|---|
id | string | The backend's id. |
Returns: True if a backend was removed.
Related types
- IRaptorLightBackend: Supplies the component on a placed RAPTOR light: a Bakery light when Bakery is installed, otherwise a Unity Light.