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: StringThe scene’s file (level1).
game_objects: BTreeMap<i64, GameObject>The scene’s GameObjects by path id.
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn read(player: &Player, file: &str) -> Result<Scene>
pub fn read(player: &Player, file: &str) -> Result<Scene>
The hierarchy of the scene file file (level1).
Sourcepub fn behaviours_of(
&self,
player: &Player,
go: i64,
) -> Result<Vec<UnityBehaviour>>
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).
Sourcepub fn behaviours(&self, player: &Player) -> Result<Vec<(i64, UnityBehaviour)>>
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.
Sourcepub fn off_flags(&self, tp: i64, component: Option<(i64, bool)>) -> Vec<OffFlag>
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.
Sourcepub fn active(&self, tp: i64) -> bool
pub fn active(&self, tp: i64) -> bool
Whether a Transform’s GameObject and all its ancestors’ are active.
Sourcepub fn path(&self, tp: i64) -> String
pub fn path(&self, tp: i64) -> String
The GameObject path of a Transform, names from the root joined by /.
Sourcepub fn transform_of(&self, game_object: i64) -> Option<i64>
pub fn transform_of(&self, game_object: i64) -> Option<i64>
The Transform of a GameObject (both path ids).
Sourcepub fn ancestors(&self, game_object: i64) -> Vec<i64>
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.
Sourcepub fn joint(&self, tp: i64) -> Result<Option<SceneJoint>>
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.
Sourcepub fn characters(&self, player: &Player) -> Result<Vec<Character>>
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.
Sourcepub fn path_below(&self, tp: i64, root: i64) -> Option<String>
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.
Sourcepub fn animators(&self, player: &Player) -> Result<Vec<Animator>>
pub fn animators(&self, player: &Player) -> Result<Vec<Animator>>
The Animators of the file, in the order of its object table.
Sourcepub fn animators_under(
&self,
player: &Player,
root: Option<i64>,
) -> Result<Vec<Animator>>
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.
Sourcepub fn relative_to(&self, tp: i64, root: i64) -> Option<Matrix>
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.
Sourcepub fn renderers(&self, player: &Player) -> Result<(Vec<Renderer>, Skipped)>
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).
Sourcepub fn lod_groups_under(
&self,
player: &Player,
root: Option<i64>,
) -> Result<Vec<LodGroup>>
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.
Sourcepub fn renderers_under(
&self,
player: &Player,
root: Option<i64>,
) -> Result<(Vec<Renderer>, Skipped)>
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.
Sourcepub fn colliders_under(
&self,
player: &Player,
root: Option<i64>,
) -> Result<Vec<ColliderComponent>>
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.
Sourcepub fn render_settings(
&self,
player: &Player,
) -> Result<Option<SceneRenderSettings>>
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.
Sourcepub fn lights(&self, player: &Player) -> Result<Vec<LightComponent>>
pub fn lights(&self, player: &Player) -> Result<Vec<LightComponent>>
The lights, whatever their state, in the order of the scene’s object table.