Table of Contents

Class CarriedLight

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A light a character carries, held a little ahead of the shoulder so the walls, the floor and the faces in front of them read in a cave the sky never reaches.

[DisallowMultipleComponent]
public sealed class CarriedLight : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
CarriedLight
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Remarks

Brighter than the walls' torches. The cut's mine and cave-camp torches are lit by SiteLightPool at about 1.6 with a three-beat flicker and a warm orange, and its buried lamps at 2.2, steady: marks along a way, not light to see it by. A carried torch uses the same flicker and very nearly the same colour (a shade redder, nearer a pitch flame's 2200 K), but at the wall torches' strength it lit the rock within an arm's length and left the rest black in the cave walkthrough render (2026-10-13: "Ensure we can see and use the torch or a stronger light source for visual clarity"). URP point lights fall off with the square of distance whatever their range, so the strength is what carries: the torch reads the floor and walls a room's width off, the lantern most of a hall's. Underground the sky's ambient falls to under a tenth (SkySystem's darkness), so these are most of what lights a cave.

Ahead, not at the hand. Parented to what the character's model is drawn under (the smoothed graphical object, HolderFor(ICharacter)), not to a hand bone: an arm swinging through a walk would swing every shadow in the cave with it, and the race model under the mesh root is destroyed and rebuilt whenever it reloads. It sits forward of the chest at shoulder height, so the body's own shadow falls behind it (away from a camera that follows from behind), and the front of the character, not the back the camera sees, takes the light's hot near field.

One shadow. Soft shadows for at most one carried light at a time (the first lit takes them, and gives them up when it goes out): a shadowed point light renders six cube faces of every caster within its range, the cost SiteLightPool already pays for its nearest few indoor lights and no more. Where the quality tier has no additional-light shadows URP draws the light unshadowed and charges nothing for asking.

Presentation only, never simulation: a server never builds one. Attach(Transform, CarriedLightMode) works in edit mode too, so a render probe can hang the same light on its camera and see what a player sees; flicker only runs in play mode.

Fields

LanternColour

A lantern's candle behind glass, about 3000 K: a touch whiter than a buried lamp's (1, 0.72, 0.42).

public static readonly Color LanternColour

Field Value

Color

LanternIntensity

The lantern's strength: twice the torch, steady, as a lantern's glass and shutter throw it forward.

public const float LanternIntensity = 12

Field Value

float

LanternRange

How far the lantern reaches, metres.

public const float LanternRange = 26

Field Value

float

ObjectName

The name of the child object the light lives on, so a holder's light can be found again.

public const string ObjectName = "Carried Light"

Field Value

string

TorchColour

A pitch flame, about 2200 K: a shade redder than the wall torches' (1, 0.66, 0.36).

public static readonly Color TorchColour

Field Value

Color

TorchIntensity

The torch's mean strength: enough to see a room's floor and walls by, about four wall torches.

public const float TorchIntensity = 6

Field Value

float

TorchRange

How far the torch reaches before its falloff is windowed to nothing, metres.

public const float TorchRange = 14

Field Value

float

Properties

Mode

What is carried now.

public CarriedLightMode Mode { get; }

Property Value

CarriedLightMode

Source

The light itself (disabled while Mode is Off).

public Light Source { get; }

Property Value

Light

Methods

Attach(Transform, CarriedLightMode)

Gives holder a carried light in mode, creating it on first use, and returns the light (disabled for Off).

public static Light Attach(Transform holder, CarriedLightMode mode)

Parameters

holder Transform

What carries it: a character's HolderFor(ICharacter), or a camera.

mode CarriedLightMode

What to carry.

Returns

Light

The light, or null when holder is null.

Remarks

On a camera it is held low and right of the eye; on anything else it is held ahead of the shoulder, measured from the nearest capsule collider at or above the holder (a character's), or from a 1.8 m figure standing at the holder when there is none. Usable outside play mode: the light is lit at once at its mean strength, and the object is never saved with a scene.

Detach(Transform)

Removes holder's carried light, if it has one.

public static void Detach(Transform holder)

Parameters

holder Transform

Find(Transform)

The carried light directly under holder, or null.

public static CarriedLight Find(Transform holder)

Parameters

holder Transform

Returns

CarriedLight

HolderFor(ICharacter)

The transform a character's light is parented to: the parent of its mesh root, which is the object FishNet smooths between ticks, so the light glides with the drawn model rather than stepping with the simulated root.

public static Transform HolderFor(ICharacter character)

Parameters

character ICharacter

The character; null gives null.

Returns

Transform

Next(CarriedLightMode)

The next mode the cycle key steps to: Off, Torch, Lantern, and round again.

public static CarriedLightMode Next(CarriedLightMode current)

Parameters

current CarriedLightMode

Returns

CarriedLightMode

SetMode(CarriedLightMode)

Changes what is carried, lighting or putting out the light at once.

public void SetMode(CarriedLightMode value)

Parameters

value CarriedLightMode