#[repr(transparent)]pub struct GameObject(pub Object);Expand description
UnityEngine.GameObject.
Tuple Fields§
§0: ObjectImplementations§
Source§impl GameObject
impl GameObject
pub const ASSEMBLY: &'static str = "UnityEngine.CoreModule"
pub const NAMESPACE: &'static str = "UnityEngine"
pub const NAME: &'static str = "GameObject"
pub fn object(&self) -> Object
pub fn is_null(&self) -> bool
pub fn name(&self) -> Result<String>
pub fn set_name(&self, name: &str) -> Result<()>
Sourcepub fn dont_destroy_on_load(&self) -> Result<()>
pub fn dont_destroy_on_load(&self) -> Result<()>
Keeps the object when a new scene loads. Only works for GameObjects;
for assets (Material, Texture2D) use set_hide_flags.
Sourcepub fn set_hide_flags(&self, flags: HideFlags) -> Result<()>
pub fn set_hide_flags(&self, flags: HideFlags) -> Result<()>
Sets the object’s HideFlags. HideFlags::HIDE_AND_DONT_SAVE keeps a
runtime-created asset from being unloaded on scene load.
Source§impl GameObject
impl GameObject
Sourcepub fn find(name: &str) -> Result<Option<Self>>
pub fn find(name: &str) -> Result<Option<Self>>
GameObject.Find(name): an active object by name or path, such as Canvas/Menu.
Sourcepub fn add_component<T: ComponentType>(&self) -> Result<T>
pub fn add_component<T: ComponentType>(&self) -> Result<T>
AddComponent(typeof(T)).
Sourcepub fn get_component<T: ComponentType>(&self) -> Result<Option<T>>
pub fn get_component<T: ComponentType>(&self) -> Result<Option<T>>
GetComponent<T>(), or None if the object has no such component.
pub fn transform(&self) -> Result<Transform>
Sourcepub fn rect_transform(&self) -> Result<Option<RectTransform>>
pub fn rect_transform(&self) -> Result<Option<RectTransform>>
The transform as a RectTransform, which objects with UI components have.
pub fn set_active(&self, active: bool) -> Result<()>
Sourcepub fn is_active(&self) -> Result<bool>
pub fn is_active(&self) -> Result<bool>
Whether the object itself is active (its own flag, ignoring parents).
Sourcepub fn is_active_in_hierarchy(&self) -> Result<bool>
pub fn is_active_in_hierarchy(&self) -> Result<bool>
Whether the object is active, taking its parents into account.
pub fn tag(&self) -> Result<String>
pub fn set_tag(&self, tag: &str) -> Result<()>
pub fn compare_tag(&self, tag: &str) -> Result<bool>
pub fn layer(&self) -> Result<i32>
pub fn set_layer(&self, layer: i32) -> Result<()>
Trait Implementations§
Source§impl Clone for GameObject
impl Clone for GameObject
impl Copy for GameObject
Source§impl Debug for GameObject
impl Debug for GameObject
impl Eq for GameObject
Source§impl Hash for GameObject
impl Hash for GameObject
Source§impl Il2CppValue for GameObject
impl Il2CppValue for GameObject
Source§impl PartialEq for GameObject
impl PartialEq for GameObject
impl StructuralPartialEq 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