pub struct UnityObject {
pub info: ObjectInfo,
pub class: UnityClass,
}Expand description
A Unity object with parsed data
Fields§
§info: ObjectInfoObject information
class: UnityClassParsed Unity class data
Implementations§
Source§impl UnityObject
impl UnityObject
Sourcepub fn new(info: ObjectInfo) -> Result<Self>
pub fn new(info: ObjectInfo) -> Result<Self>
Create a new Unity object
Sourcepub fn class_name(&self) -> &str
pub fn class_name(&self) -> &str
Get the object’s class name
Sourcepub fn get(&self, key: &str) -> Option<&UnityValue>
pub fn get(&self, key: &str) -> Option<&UnityValue>
Get a property value
Sourcepub fn set(&mut self, key: String, value: UnityValue)
pub fn set(&mut self, key: String, value: UnityValue)
Set a property value
Sourcepub fn has_property(&self, key: &str) -> bool
pub fn has_property(&self, key: &str) -> bool
Check if the object has a property
Sourcepub fn property_names(&self) -> Vec<&String>
pub fn property_names(&self) -> Vec<&String>
Get all property names
Sourcepub fn as_unity_class(&self) -> &UnityClass
pub fn as_unity_class(&self) -> &UnityClass
Get the underlying UnityClass
Sourcepub fn as_unity_class_mut(&mut self) -> &mut UnityClass
pub fn as_unity_class_mut(&mut self) -> &mut UnityClass
Get the underlying UnityClass (mutable)
Sourcepub fn as_gameobject(&self) -> Result<GameObject>
pub fn as_gameobject(&self) -> Result<GameObject>
Try to parse this object as a GameObject
Sourcepub fn as_transform(&self) -> Result<Transform>
pub fn as_transform(&self) -> Result<Transform>
Try to parse this object as a Transform
Sourcepub fn is_gameobject(&self) -> bool
pub fn is_gameobject(&self) -> bool
Check if this object is a GameObject
Sourcepub fn is_transform(&self) -> bool
pub fn is_transform(&self) -> bool
Check if this object is a Transform
Sourcepub fn parse_with_typetree(
&self,
typetree: &TypeTree,
) -> Result<IndexMap<String, UnityValue>>
pub fn parse_with_typetree( &self, typetree: &TypeTree, ) -> Result<IndexMap<String, UnityValue>>
Parse object data using TypeTree (dictionary mode)
Sourcepub fn byte_start(&self) -> u64
pub fn byte_start(&self) -> u64
Get object byte start position
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