#[repr(C)]pub struct MonoBehaviour {
pub component: Component,
}Expand description
Wrapper around Unity’s MonoBehaviour component
MonoBehaviour is the base class from which every Unity script derives. This wrapper provides access to coroutine functionality.
Fields§
§component: ComponentBase Component structure
Implementations§
Source§impl MonoBehaviour
impl MonoBehaviour
Sourcepub fn start_coroutine(
&self,
enumerator: *mut c_void,
) -> Result<Coroutine, String>
pub fn start_coroutine( &self, enumerator: *mut c_void, ) -> Result<Coroutine, String>
Starts a coroutine with the given IEnumerator
This calls MonoBehaviour.StartCoroutine(IEnumerator routine) on the
Unity side. The IEnumerator should be created from a method that
returns IEnumerator (e.g., a generator method).
§Arguments
enumerator- Pointer to the IEnumerator object
§Returns
Result<Coroutine, String>- The started Coroutine, or an error
Sourcepub fn stop_all_coroutines(&self) -> Result<(), String>
pub fn stop_all_coroutines(&self) -> Result<(), String>
Stops all coroutines running on this MonoBehaviour
§Returns
Result<(), String>- Ok if successful, or an error
Sourcepub fn get_enabled(&self) -> Result<bool, String>
pub fn get_enabled(&self) -> Result<bool, String>
Methods from Deref<Target = Component>§
Sourcepub fn get_game_object(&self) -> Result<GameObject, String>
pub fn get_game_object(&self) -> Result<GameObject, String>
Returns the GameObject attached to this component.
Sourcepub fn get_transform(&self) -> Result<Transform, String>
pub fn get_transform(&self) -> Result<Transform, String>
Returns the Transform attached to this component.
Sourcepub fn get_component<T: ComponentTrait>(
&self,
class: &Class,
) -> Result<T, String>
pub fn get_component<T: ComponentTrait>( &self, class: &Class, ) -> Result<T, String>
Resolves another component of the specified class on the same GameObject.
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 MonoBehaviour
impl Clone for MonoBehaviour
Source§fn clone(&self) -> MonoBehaviour
fn clone(&self) -> MonoBehaviour
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more