#[repr(C)]pub struct UnityObject {
pub object: Object,
pub m_cached_ptr: *mut c_void,
}Expand description
Wrapper for a managed UnityEngine.Object.
This sits between the generic Object wrapper and more specific Unity
types such as GameObject, Component, and Transform.
Fields§
§object: ObjectBase Object structure
m_cached_ptr: *mut c_voidCached pointer to the object
Implementations§
Source§impl UnityObject
impl UnityObject
Sourcepub fn to_string(&self) -> Result<String, String>
pub fn to_string(&self) -> Result<String, String>
Returns the managed ToString() representation.
Sourcepub fn instantiate(original: &UnityObject) -> Result<UnityObject, String>
pub fn instantiate(original: &UnityObject) -> Result<UnityObject, String>
Clones the given Unity object using Object.Instantiate.
Sourcepub fn instantiate_at(
original: &UnityObject,
position: Vector3,
rotation: Quaternion,
) -> Result<UnityObject, String>
pub fn instantiate_at( original: &UnityObject, position: Vector3, rotation: Quaternion, ) -> Result<UnityObject, String>
Clones the object at the given position and rotation.
Sourcepub fn instantiate_with_parent(
original: &UnityObject,
parent: &Transform,
) -> Result<UnityObject, String>
pub fn instantiate_with_parent( original: &UnityObject, parent: &Transform, ) -> Result<UnityObject, String>
Clones the object and parents it under parent.
Sourcepub fn destroy(&self, time_delay: f32) -> Result<(), String>
pub fn destroy(&self, time_delay: f32) -> Result<(), String>
Schedules this object for destruction after time_delay seconds.
Sourcepub fn destroy_immediate(
obj: &UnityObject,
allow_destroying_assets: bool,
) -> Result<(), String>
pub fn destroy_immediate( obj: &UnityObject, allow_destroying_assets: bool, ) -> Result<(), String>
Destroys the object immediately.
Sourcepub fn dont_destroy_on_load(obj: &UnityObject) -> Result<(), String>
pub fn dont_destroy_on_load(obj: &UnityObject) -> Result<(), String>
Marks the object to survive scene loads.
Methods from Deref<Target = Object>§
Sourcepub fn field(&self, name: &str) -> Option<Field>
pub fn field(&self, name: &str) -> Option<Field>
Returns an instance-bound field lookup.
The returned Field carries this object’s instance pointer so
Field::get_value and
Field::set_value can operate on it.
Sourcepub fn method<S: MethodSelector>(&self, selector: S) -> Option<Method>
pub fn method<S: MethodSelector>(&self, selector: S) -> Option<Method>
Returns an instance-bound method lookup.
This is the preferred way to prepare instance method calls because the
returned Method already carries the correct this pointer.
Sourcepub fn property(&self, name: &str) -> Option<Property>
pub fn property(&self, name: &str) -> Option<Property>
Returns an instance-bound property lookup.
Sourcepub fn il2cpp_to_string(&self) -> String
pub fn il2cpp_to_string(&self) -> String
Sourcepub fn get_game_object(&self) -> Result<GameObject, String>
pub fn get_game_object(&self) -> Result<GameObject, String>
Gets the GameObject associated with this object (if Is a Component)
§Returns
Result<GameObject, String>- The GameObject, or an error if null/not found
Sourcepub fn get_virtual_method(&self, method: &Method) -> *mut c_void
pub fn get_virtual_method(&self, method: &Method) -> *mut c_void
Sourcepub fn init_exception(&self, exc: &mut c_void)
pub fn init_exception(&self, exc: &mut c_void)
Trait Implementations§
Source§impl Clone for UnityObject
impl Clone for UnityObject
Source§fn clone(&self) -> UnityObject
fn clone(&self) -> UnityObject
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more