Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
    pub file: String,
    pub game_objects: BTreeMap<i64, GameObject>,
    /* private fields */
}
Expand description

A scene file’s hierarchy: its GameObjects and Transforms, and from them the paths and world matrices of what the scene holds.

Fields§

§file: String

The scene’s file (level1).

§game_objects: BTreeMap<i64, GameObject>

The scene’s GameObjects by path id.

Implementations§

Source§

impl Scene

Source

pub fn read(player: &Player, file: &str) -> Result<Scene>

The hierarchy of the scene file file (level1).

Source

pub fn behaviours_of( &self, player: &Player, go: i64, ) -> Result<Vec<UnityBehaviour>>

The MonoBehaviours of GameObject go, in its component order: the script (namespace.class, empty when it can’t be resolved), m_Enabled, and the script’s serialized fields as bytes (a stripped build has no type tree for them).

Source

pub fn behaviours(&self, player: &Player) -> Result<Vec<(i64, UnityBehaviour)>>

Every MonoBehaviour of the scene, by GameObject (in path id order), as Scene::behaviours_of gives them.

Source

pub fn world_of(&self, tp: i64) -> Result<Matrix>

A Transform’s world matrix (Unity frame).

Source

pub fn off_flags(&self, tp: i64, component: Option<(i64, bool)>) -> Vec<OffFlag>

The off flags of a component on Transform tp’s GameObject: the GameObjects stored inactive from the root down, then the component ((path id, enabled)) when it is stored disabled.

Source

pub fn active(&self, tp: i64) -> bool

Whether a Transform’s GameObject and all its ancestors’ are active.

Source

pub fn path(&self, tp: i64) -> String

The GameObject path of a Transform, names from the root joined by /.

Source

pub fn transform_of(&self, game_object: i64) -> Option<i64>

The Transform of a GameObject (both path ids).

Source

pub fn ancestors(&self, game_object: i64) -> Vec<i64>

A GameObject and the GameObjects above it on its Transform chain, itself first, the root last; a GameObject without a Transform is alone.

Source

pub fn joint(&self, tp: i64) -> Result<Option<SceneJoint>>

Transform tp as a joint (SceneJoint); None when it is no Transform of this file. A RectTransform’s position is the one its anchors give (as in its local matrix), its rotation and scale as stored.

Source

pub fn characters(&self, player: &Player) -> Result<Vec<Character>>

The characters of the file: its Animators with skinned renderers below them, in the order of its object table.

Source

pub fn path_below(&self, tp: i64, root: i64) -> Option<String>

The names of the GameObjects from the child of Transform root down to Transform tp joined by / (empty for root itself): a path as an Animator’s clips name their targets. None when root is not tp or one of its ancestors.

Source

pub fn animators(&self, player: &Player) -> Result<Vec<Animator>>

The Animators of the file, in the order of its object table.

Source

pub fn animators_under( &self, player: &Player, root: Option<i64>, ) -> Result<Vec<Animator>>

The Animators on the GameObject root and its descendants (a prefab’s), all of the file’s with None.

Source

pub fn local_of(&self, tp: i64) -> Option<Matrix>

A Transform’s local matrix.

Source

pub fn relative_to(&self, tp: i64, root: i64) -> Option<Matrix>

The matrix of Transform tp relative to its ancestor root (the product of the locals below root), or None when root is not tp or an ancestor of it.

Source

pub fn renderers(&self, player: &Player) -> Result<(Vec<Renderer>, Skipped)>

The mesh renderers, in the order of the scene’s object table, and what was skipped (no transform, no MeshFilter, no mesh).

Source

pub fn lod_groups_under( &self, player: &Player, root: Option<i64>, ) -> Result<Vec<LodGroup>>

The LODGroups of the GameObject root and its descendants (a prefab’s), all of the file’s with None, in the order of the object table.

Source

pub fn renderers_under( &self, player: &Player, root: Option<i64>, ) -> Result<(Vec<Renderer>, Skipped)>

The mesh renderers of the GameObject root and its descendants (a prefab’s), their matrices relative to root; all of the file’s with None.

Source

pub fn colliders_under( &self, player: &Player, root: Option<i64>, ) -> Result<Vec<ColliderComponent>>

Every Box, Sphere, Capsule and Mesh collider of the GameObject root and its descendants (a prefab’s, matrices relative to root), or of the whole file with None, in the order of the object table: those that do not collide (inactive, disabled, triggers) included, flagged.

Source

pub fn render_settings( &self, player: &Player, ) -> Result<Option<SceneRenderSettings>>

The scene’s RenderSettings: the Light it names as its sun (m_Sun; None when it names none: Unity then lights its procedural sky by the brightest directional light, a choice of the engine’s, not the scene’s) and its ambient lighting. None when the scene has no RenderSettings.

Source

pub fn lights(&self, player: &Player) -> Result<Vec<LightComponent>>

The lights, whatever their state, in the order of the scene’s object table.

Source

pub fn cameras(&self, player: &Player) -> Result<Vec<CameraComponent>>

The cameras, whatever their state, in the order of the scene’s object table.

Source

pub fn terrains( &self, player: &Player, ) -> Result<(Vec<TerrainComponent>, Skipped)>

The terrains, whatever their state, in the order of the scene’s object table, and what was skipped (no transform, no terrain data: a Terrain that names no TerrainData draws nothing).

Trait Implementations§

Source§

impl Debug for Scene

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Scene

§

impl RefUnwindSafe for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

§

impl UnwindSafe for Scene

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.