pub struct Player {
pub dir: PathBuf,
pub files: BTreeMap<String, SerializedFile>,
pub folders: BTreeMap<String, PathBuf>,
/* private fields */
}Expand description
A Unity player’s data folder, read: every SerializedFile in it (and in its Resources folder), and the type tree
package that decodes their objects. Objects are named by ObjRef and decoded on demand.
Fields§
§dir: PathBufThe data folder.
files: BTreeMap<String, SerializedFile>By lower-case file name: level1, sharedassets1.assets, unity default resources, …
folders: BTreeMap<String, PathBuf>The folder each file is in (its streamed resources are beside it).
Implementations§
Source§impl Player
impl Player
Sourcepub fn open(dir: &Path, package: TypeTreePackage) -> Result<Self>
pub fn open(dir: &Path, package: TypeTreePackage) -> Result<Self>
The serialized files of dir (the <Game>_Data folder) and of its Resources folder, read with package’s
class layouts. Files of other kinds (resources, bundles, configs) are skipped.
A file whose header is a SerializedFile’s of a version this crate does not read is refused, not left out: a
player with such a file would otherwise read as one without it. Two files the player would name alike (they
differ by case, or one is in the data folder and one in Resources) are refused too.
Sourcepub fn file(&self, name: &str) -> Result<&SerializedFile>
pub fn file(&self, name: &str) -> Result<&SerializedFile>
The serialized file called name (lower case), or an error naming it.
Sourcepub fn class_id(&self, r: &ObjRef) -> Option<i32>
pub fn class_id(&self, r: &ObjRef) -> Option<i32>
The class id of an object (None: no such object).
Sourcepub fn class_name(&self, r: &ObjRef) -> Option<&str>
pub fn class_name(&self, r: &ObjRef) -> Option<&str>
The class name of an object, from the type tree package.
Sourcepub fn decode(&self, r: &ObjRef) -> Result<Value>
pub fn decode(&self, r: &ObjRef) -> Result<Value>
Decode an object (its type tree must cover it; a MonoBehaviour’s base fields only).
Sourcepub fn field(&self, r: &ObjRef, name: &str) -> Result<Option<Value>>
pub fn field(&self, r: &ObjRef, name: &str) -> Result<Option<Value>>
The field name of the object’s root struct alone (TypeTree::decode_field): None when its class has no
such field. The object need not decode whole, and a field stored early (m_Name) is read without the rest.
Sourcepub fn scenes(&self) -> Result<Vec<BuildScene>>
pub fn scenes(&self) -> Result<Vec<BuildScene>>
The scenes of the build, in BuildSettings’ order: scene i is the file level<i>. Ok(empty) for a player
without a globalgamemanagers or a BuildSettings (a player is never read for scenes it does not list).
Sourcepub fn behaviour(&self, r: &ObjRef) -> Result<(Value, Vec<u8>)>
pub fn behaviour(&self, r: &ObjRef) -> Result<(Value, Vec<u8>)>
A MonoBehaviour’s base fields and its script’s serialized bytes, which a stripped build has no type tree for.
Sourcepub fn render_pipeline(&self) -> Result<Option<RenderPipeline>>
pub fn render_pipeline(&self) -> Result<Option<RenderPipeline>>
The player’s RenderPipeline, from globalgamemanagers’ GraphicsSettings and QualitySettings; None when
the player has no GraphicsSettings.
Sourcepub fn urp_asset(&self, quality: Option<&str>) -> Result<Option<ObjRef>>
pub fn urp_asset(&self, quality: Option<&str>) -> Result<Option<ObjRef>>
The Universal Render Pipeline asset the quality level quality draws with (every level’s when none is named
and they all draw with one); Ok(None) when the level (or the levels) draw with no URP asset, or with more
than one where no level is named. An unknown level name is an error.
Sourcepub fn quality_levels(&self) -> Result<Vec<QualityLevel>>
pub fn quality_levels(&self) -> Result<Vec<QualityLevel>>
The quality levels of globalgamemanagers’ QualitySettings, in order, each with its name and the skin weights
it allows; none when the player has no QualitySettings. Which level is current at run time is not data a
consumer can read (see Player::build_quality), so a consumer states the level it wants where levels differ.
Sourcepub fn build_quality(&self) -> Result<Option<String>>
pub fn build_quality(&self) -> Result<Option<String>>
The name of the level the build was made with: the level m_CurrentQuality of the player’s QualitySettings
indexes (the three players read so far hold the top or only level). It is what the build states, not what the
game runs at: a game may change its quality level at run time. None when the player has no QualitySettings or
states no m_CurrentQuality; an index outside the levels is an error. (The per-platform default
m_PerPlatformDefaultQuality is not in a player: SkateBIRD, Sledding Game and PEAK carry none.)