Sprite

class in UnityEngine

/

Inherits from:Object

Switch to Manual

Description

Описывает объект Sprite для использования в 2D геймплее.

"Спрайты" - 2D графические объекты, используемые для персонажей, бутафории, снарядов и других элементов 2D геймплея. Графика получается из растровых изображений - Texture2D. Класс Sprite прежде всего определяет часть изображения, которая должна быть использована для определенного спрайта. Затем эта информация используется компонентом SpriteRenderer на игровом объекте для реального отображения графики.

См. также: SpriteRenderer класс.

Variables

associatedAlphaSplitTextureReturns the texture that contains the alpha channel from the source texture. Unity generates this texture under the hood for sprites that have alpha in the source, and need to be compressed using techniques like ETC1.Returns NULL if there is no associated alpha texture for the source sprite. This is the case if the sprite has not been setup to use ETC1 compression.
borderВозвращает границы размеров спрайта.
bounds Bounds of the Sprite, specified by its center and extents in world space units.
packedВозвращает true если спрайт запакован в атлас.
packingModeЕсли спрайт запакован (см. Sprite.packed), возвращает SpritePackingMode.
packingRotationЕсли спрайт запакован (см. Sprite.packed), возвращает SpritePackingRotation.
pivotМестоположение спрайта на оригинальной текстуре, определена в пикселях.
pixelsPerUnitКоличество пикселей спрайта, соответствующих одной единице в мировом пространстве. (Read Only)
rectМестоположение спрайта на оригинальной текстуре, определена в пикселях.
textureПолучает ссылку на используемую текстуру. Если она упакована, будет указатель на атлас, если нет - на источник спрайта.
textureRectПолучить прямоугольник спрайта, используемый на его текстуре. Вызывает исключение, если этот спрайт упакован в атлас.
textureRectOffsetПолучает смещение прямоугольника этого спрайта, использующего его текстуру относительно оригинальной границы спрайта. Если тип меша спрайта FullRect, смещение нулевое.
trianglesReturns a copy of the array containing sprite mesh triangles.
uvВозвращает границы размеров спрайта.
verticesReturns a copy of the array containing sprite mesh vertex positions.

Public Functions

GetPhysicsShapeGets a physics shape from the Sprite by its index.
GetPhysicsShapeCountThe number of physics shapes for the Sprite.
GetPhysicsShapePointCountThe number of points in the selected physics shape for the Sprite.
OverrideGeometryСоздаёт новый объект Sprite.
OverridePhysicsShapeSets up a new Sprite physics shape.

Static Functions

CreateСоздаёт новый объект Sprite.

Inherited members

Variables

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Functions

GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the object.

Static Functions

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.