pub struct UnityObject {
pub info: ObjectInfo,
pub class: UnityClass,
/* private fields */
}Expand description
A parsed Unity object.
This is an owned wrapper which carries:
- the raw
ObjectInfo(fromassetmodule) - the parsed
UnityClassproperties (best-effort)
Fields§
§info: ObjectInfo§class: UnityClassImplementations§
Source§impl UnityObject
impl UnityObject
Sourcepub fn from_info_and_class(info: ObjectInfo, class: UnityClass) -> UnityObject
pub fn from_info_and_class(info: ObjectInfo, class: UnityClass) -> UnityObject
Create a UnityObject from an already-parsed UnityClass (used by tests and higher-level code).
Sourcepub fn from_raw(class_id: i32, path_id: i64, data: Vec<u8>) -> UnityObject
pub fn from_raw(class_id: i32, path_id: i64, data: Vec<u8>) -> UnityObject
Create a UnityObject from raw bytes without TypeTree information.
For large objects, this intentionally avoids expanding all bytes into a UnityValue::Array
to reduce memory pressure and parsing time; use raw_data() instead.
Sourcepub fn from_serialized_file(
file: &SerializedFile,
info: &ObjectInfo,
) -> Result<UnityObject, BinaryError>
pub fn from_serialized_file( file: &SerializedFile, info: &ObjectInfo, ) -> Result<UnityObject, BinaryError>
Create a UnityObject from a SerializedFile + ObjectInfo, using TypeTree when available.
pub fn from_serialized_file_with_options( file: &SerializedFile, info: &ObjectInfo, options: TypeTreeParseOptions, ) -> Result<UnityObject, BinaryError>
pub fn path_id(&self) -> i64
pub fn class_id(&self) -> i32
pub fn class_name(&self) -> &str
pub fn name(&self) -> Option<String>
pub fn get(&self, key: &str) -> Option<&UnityValue>
pub fn set(&mut self, key: String, value: UnityValue)
pub fn has_property(&self, key: &str) -> bool
pub fn property_names(&self) -> Vec<&String>
pub fn as_unity_class(&self) -> &UnityClass
pub fn as_unity_class_mut(&mut self) -> &mut UnityClass
pub fn as_gameobject(&self) -> Result<GameObject, BinaryError>
pub fn as_transform(&self) -> Result<Transform, BinaryError>
pub fn is_gameobject(&self) -> bool
pub fn is_transform(&self) -> bool
pub fn describe(&self) -> String
pub fn raw_data(&self) -> &[u8] ⓘ
pub fn typetree_warnings(&self) -> &[TypeTreeParseWarning]
pub fn byte_size(&self) -> u32
pub fn byte_start(&self) -> u64
pub fn byte_order(&self) -> ByteOrder
Trait Implementations§
Source§impl Clone for UnityObject
impl Clone for UnityObject
Source§fn clone(&self) -> UnityObject
fn clone(&self) -> UnityObject
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for UnityObject
impl RefUnwindSafe for UnityObject
impl Send for UnityObject
impl Sync for UnityObject
impl Unpin for UnityObject
impl UnwindSafe for UnityObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more