Sprite

Struct Sprite 

Source
pub struct Sprite {
Show 14 fields pub m_Extrude: u32, pub m_Name: String, pub m_Offset: Vector2f, pub m_PixelsToUnits: f32, pub m_RD: SpriteRenderData, pub m_Rect: Rectf, pub m_AtlasTags: Option<Vec<String>>, pub m_Bones: Option<Vec<SpriteBone>>, pub m_Border: Option<Vector4f>, pub m_IsPolygon: Option<bool>, pub m_PhysicsShape: Option<Vec<Vec<Vector2f>>>, pub m_Pivot: Option<Vector2f>, pub m_RenderDataKey: Option<(GUID, i64)>, pub m_SpriteAtlas: Option<PPtr>,
}
Expand description

Sprite is a class of the Unity engine since version 4.3.0. Exert from Unity’s scripting documentation: Represents a Sprite object for use in 2D gameplay. Sprites are 2D graphic objects used for characters, props, projectiles and other elements of 2D gameplay. The graphics are obtained from bitmap images - Texture2D. The Sprite class primarily identifies the section of the image that should be used for a specific Sprite. This information can then be used by a SpriteRenderer component on a GameObject to actually display the graphic.See Also: SpriteRenderer class.

Fields§

§m_Extrude: u32§m_Name: String

The name of the object.

§m_Offset: Vector2f§m_PixelsToUnits: f32§m_RD: SpriteRenderData§m_Rect: Rectf

Location of the Sprite on the original Texture, specified in pixels.

§m_AtlasTags: Option<Vec<String>>

Vec: (2017.1.0b1 - 2022.3.2f1)

§m_Bones: Option<Vec<SpriteBone>>

Vec: (2018.1.0b2 - 2022.3.2f1)

§m_Border: Option<Vector4f>

Returns the border sizes of the Sprite. Vector4f: (4.5.0 - 2022.3.2f1)

§m_IsPolygon: Option<bool>

bool: (5.3.0f1 - 2022.3.2f1)

§m_PhysicsShape: Option<Vec<Vec<Vector2f>>>

Vec<Vec>: (2017.1.0b1 - 2022.3.2f1)

§m_Pivot: Option<Vector2f>

Location of the Sprite’s center point in the Rect on the original Texture, specified in pixels. Vector2f: (5.4.2f2 - 2022.3.2f1)

§m_RenderDataKey: Option<(GUID, i64)>

(GUID, i64): (2017.1.0b1 - 2022.3.2f1)

§m_SpriteAtlas: Option<PPtr>

PPtr<SpriteAtlas>: (2017.1.0b1 - 2022.3.2f1)

Trait Implementations§

Source§

impl Debug for Sprite

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Sprite

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Sprite

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Sprite

§

impl RefUnwindSafe for Sprite

§

impl Send for Sprite

§

impl Sync for Sprite

§

impl Unpin for Sprite

§

impl UnwindSafe for Sprite

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,