#[repr(transparent)]pub struct GameObject {
pub object: UnityObject,
}Expand description
Wrapper for a managed UnityEngine.GameObject.
This builds on top of UnityObject and is useful once you already have a
live Unity object or want to find a scene object by name.
Fields§
§object: UnityObjectBase UnityObject structure
Implementations§
Source§impl GameObject
impl GameObject
Sourcepub fn internal_create(obj: &mut GameObject, name: &str) -> Result<(), String>
pub fn internal_create(obj: &mut GameObject, name: &str) -> Result<(), String>
Sourcepub fn get_component<T: ComponentTrait>(
&self,
class: &Class,
) -> Result<T, String>
pub fn get_component<T: ComponentTrait>( &self, class: &Class, ) -> Result<T, String>
Sourcepub fn get_transform(&self) -> Result<Transform, String>
pub fn get_transform(&self) -> Result<Transform, String>
Gets the Transform attached to this GameObject
§Returns
Result<Transform, String>- The Transform attached to this GameObject
Sourcepub fn get_active_self(&self) -> Result<bool, String>
pub fn get_active_self(&self) -> Result<bool, String>
Sourcepub fn get_active_in_hierarchy(&self) -> Result<bool, String>
pub fn get_active_in_hierarchy(&self) -> Result<bool, String>
Checks if the GameObject is active in the hierarchy
§Returns
Result<bool, String>- True if active in hierarchy
Sourcepub fn get_is_static(&self) -> Result<bool, String>
pub fn get_is_static(&self) -> Result<bool, String>
Methods from Deref<Target = UnityObject>§
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 GameObject
impl Clone for GameObject
Source§fn clone(&self) -> GameObject
fn clone(&self) -> GameObject
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 moreSource§impl Debug for GameObject
impl Debug for GameObject
Auto Trait Implementations§
impl Freeze for GameObject
impl RefUnwindSafe for GameObject
impl !Send for GameObject
impl !Sync for GameObject
impl Unpin for GameObject
impl UnsafeUnpin for GameObject
impl UnwindSafe for GameObject
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