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) -> Self
pub fn from_info_and_class(info: ObjectInfo, class: UnityClass) -> Self
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>) -> Self
pub fn from_raw(class_id: i32, path_id: i64, data: Vec<u8>) -> Self
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<Self>
pub fn from_serialized_file( file: &SerializedFile, info: &ObjectInfo, ) -> Result<Self>
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<Self>
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>
pub fn as_transform(&self) -> Result<Transform>
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