#[repr(transparent)]pub struct Transform(pub Object);Expand description
UnityEngine.Transform: position in the scene and the parent/child hierarchy.
Tuple Fields§
§0: ObjectImplementations§
Source§impl Transform
impl Transform
Sourcepub const ASSEMBLY: &'static str = "UnityEngine.CoreModule"
pub const ASSEMBLY: &'static str = "UnityEngine.CoreModule"
The assembly (.dll name without the extension) that defines the class.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Whether this is a null reference. A destroyed object isn’t null;
check is_alive for that.
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 Transform
impl Transform
Sourcepub fn set_parent(
&self,
parent: Transform,
world_position_stays: bool,
) -> Result<()>
pub fn set_parent( &self, parent: Transform, world_position_stays: bool, ) -> Result<()>
Re-parents this transform under parent. With world_position_stays
the object keeps its place in the world; without, its local position,
rotation and scale are kept relative to the new parent.
Sourcepub fn set_local_scale(&self, scale: Vector3) -> Result<()>
pub fn set_local_scale(&self, scale: Vector3) -> Result<()>
Scale relative to the parent.
Sourcepub fn set_position(&self, position: Vector3) -> Result<()>
pub fn set_position(&self, position: Vector3) -> Result<()>
Moves the transform to a world-space position.
Sourcepub fn local_position(&self) -> Result<Vector3>
pub fn local_position(&self) -> Result<Vector3>
Position relative to the parent.
Sourcepub fn set_local_position(&self, position: Vector3) -> Result<()>
pub fn set_local_position(&self, position: Vector3) -> Result<()>
Moves the transform to a position relative to its parent.
Sourcepub fn euler_angles(&self) -> Result<Vector3>
pub fn euler_angles(&self) -> Result<Vector3>
World-space rotation as Euler angles in degrees.
Sourcepub fn rotation(&self) -> Result<Quaternion>
pub fn rotation(&self) -> Result<Quaternion>
World-space rotation.
Sourcepub fn set_rotation(&self, rotation: Quaternion) -> Result<()>
pub fn set_rotation(&self, rotation: Quaternion) -> Result<()>
Sets the world-space rotation; see Quaternion::euler.
Sourcepub fn parent(&self) -> Result<Option<Transform>>
pub fn parent(&self) -> Result<Option<Transform>>
The parent transform, or None at the scene root.
Sourcepub fn child_count(&self) -> Result<i32>
pub fn child_count(&self) -> Result<i32>
The number of direct children.
Trait Implementations§
Source§impl ComponentType for Transform
impl ComponentType for Transform
Source§const ASSEMBLY: &'static str = "UnityEngine.CoreModule"
const ASSEMBLY: &'static str = "UnityEngine.CoreModule"
.dll name without the extension) that defines the class.Source§fn from_object(object: Object) -> Self
fn from_object(object: Object) -> Self
Source§fn game_object(&self) -> Result<GameObject>
fn game_object(&self) -> Result<GameObject>
Component.gameObject: the game object this component is attached to.Source§fn transform(&self) -> Result<Transform>
fn transform(&self) -> Result<Transform>
Component.transform: the transform of this component’s game object.Source§fn get_component<U: ComponentType>(&self) -> Result<Option<U>>
fn get_component<U: ComponentType>(&self) -> Result<Option<U>>
GetComponent<U>() on this component’s game object, or None if absent.Source§fn is_enabled(&self) -> Result<bool>
fn is_enabled(&self) -> Result<bool>
Behaviour-derived components
(MonoBehaviour, Canvas, …); meaningless on a plain Transform.impl Copy for Transform
impl Eq for Transform
Source§impl Il2CppValue for Transform
impl Il2CppValue for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Forget for Transform
impl Freeze for Transform
impl Move for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
Blanket Implementations§
impl<T> AsId for T
impl<T> AsIdSalt for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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