Skip to main content

Module scene

Module scene 

Source
Expand description

A scene’s hierarchy: GameObjects, their Transforms (local TRS composed to world matrices in Unity’s frame), and its mesh renderers (skinned ones with their bones), LODGroups, colliders, lights and terrains, each whatever its state.

State is data: each object carries its OffFlags, the GameObjects on its Transform chain stored inactive and the component itself stored disabled; Unity draws or uses it when it has none. A LODGroup lists its levels’ renderers (LodGroup); which level draws is Unity’s choice by screen size. A static-batched renderer draws a slice of a combined mesh whose vertices are already in world space (its matrix is the identity). A RectTransform’s local x and y come from its anchors (the stored position can be stale): the parent rect’s minimum plus its size times the anchors interpolated at the pivot, plus the anchored position.

Structs§

Animator
An Animator component: the GameObject it animates (its Transform is the root of the paths its clips name), the controller that lists its clips and its avatar; a null pointer is None.
CameraComponent
A camera as stored: its culling mask (m_CullingMask, the layers it draws; all when absent) and the texture it renders into (m_TargetTexture; None: it draws to the screen).
Character
A character: an Animator with skinned renderers on its GameObject or below it.
ColliderComponent
A collider as stored: its shape, its off flags, whether it is a trigger, its physic material, and the Rigidbody on it or its nearest ancestor (Some(true): kinematic).
GameObject
A GameObject as stored.
LightComponent
A light as stored: Unity’s LightType (0 spot, 1 directional, 2 point, 3 rectangle, 4 disc), colour as stored (gamma-encoded), intensity, range, spot angles in degrees (full cone), shadow type, colour temperature (Kelvin, when used), bounce intensity, URP’s light unit and lux-at-distance, area size, render mode and culling mask.
LodGroup
A LODGroup: its levels’ renderers (path ids in the scene’s file, a level’s in stored order, null entries left out), finest first; whether the component is enabled (a disabled LODGroup switches no level off) and its own off flags.
Renderer
A mesh renderer with a mesh, whatever its state.
RendererSkin
A skinned renderer’s bones: the Transforms (path ids in the renderer’s file) its mesh’s bone slots name, in slot order, and its root bone; a null entry stays None.
Scene
A scene file’s hierarchy: its GameObjects and Transforms, and from them the paths and world matrices of what the scene holds.
SceneJoint
A Transform as a joint of a skeleton: its GameObject’s name, its father (a Transform’s path id) and its local position, rotation ([x, y, z, w]) and scale as stored, in Unity’s frame.
SceneRenderSettings
A scene’s RenderSettings as read (Scene::render_settings).
TerrainColliderComponent
A terrain’s collider: its own TerrainData (which may differ from the drawn one), physic material, tree colliders.
TerrainComponent
A terrain, whatever its state: its GameObject’s path and world matrix (a terrain is placed by its position only), its data, material, collider and off flags (drawn when empty).
UnityAmbient
A scene’s ambient lighting as RenderSettings stores it: mode (m_AmbientMode: 0 skybox, 1 trilight, a gradient of the sky, equator and ground colours, 3 flat, the sky colour alone, 4 custom), the three colours as stored, intensity (m_AmbientIntensity) and the ambient probe as stored (m_AmbientProbe, Unity’s SphericalHarmonicsL2: nine coefficients per channel, red 0..8, green 9..17, blue 18..26; None when the RenderSettings store none). The probe is what the editor last generated: all zeros when it never did, and not necessarily from the colours stored beside it.
UnityBehaviour
A MonoBehaviour as stored: its script (namespace and class) and the script’s serialized fields, kept as bytes (a stripped build has no type tree for them).
UnityFog
The scene’s fog as RenderSettings stores it: whether it is on (m_Fog), its mode (m_FogMode: 1 linear, 2 exponential, 3 exponential squared), its colour, density (exponential modes) and the linear mode’s start and end.

Enums§

ColliderShape
A collider’s shape as stored, in its GameObject’s space (Unity’s frame).
OffFlag
A stored “off” between an object and being drawn or used: a GameObject on its Transform chain stored inactive (m_IsActive), or the component itself stored disabled (m_Enabled); path ids in the scene’s file.

Constants§

IDENTITY
The identity matrix.

Functions§

mul
The product a * b.
trs
Unity’s Matrix4x4.TRS: translation, rotation (the quaternion as stored), scale.

Type Aliases§

Matrix
A 4x4 matrix, rows of columns (m[row][col]), column vectors: Unity’s Matrix4x4 layout, in f64.
Skipped
What the scene reading skipped, by reason.