用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:sprite:sprite

Sprite 精灵

Namespace: UnityEngine

Inherits from: Object

Description 描述

Represents a Sprite object for use in 2D gameplay. 表示用于2D游戏的一个精灵对象。

Sprites are 2D graphic objects used for characters, props, projectiles and other elments 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.

Sprites是个用于角色、道具、炮弹以及其他2D游戏元素的二维图形对象。该图形是基于Texture2D得到的图像。Sprite类主要识别图像的一部分用于特定的精灵。此类通过游戏对象上的SpriteRenderer组件应用并实际显示该图像。

See Also: SpriteRenderer class.

Variables 变量

border Returns the border sizes of the sprite.
返回精灵的边框大小。
bounds Bounds of the Sprite, specified by its center and extents in world space units.
精灵的边界,在世界坐标单位,由它的中心及扩展指定。
packed Returns true if this Sprite is packed in an atlas.
如果该精灵在图集已经被打包,返回真。
packingMode If Sprite is packed (see Sprite.packed), returns its SpritePackingMode.
如果精灵已经被打包(见Sprite.packed),返回它的SpritePackingModeSpritePackingMode。
packingRotation If Sprite is packed (see Sprite.packed), returns its SpritePackingRotation.
如果精灵已被打包(见Sprite.packed),返回它的SpritePackingRotation。
rect Location of the Sprite on the original Texture, specified in pixels.
在原始纹理精灵的位置,以像素单位。
texture Get the reference to the used texture. If packed this will point to the atlas, if not packed will point to the source sprite.
获取使用的纹理引用。如果如果已打包,会将指向图集,如果没有打包将指向源精灵。
textureRect Get the rectangle this sprite uses on its texture. Raises an exception if this sprite is tightly packed in an atlas.
获取该精灵它使用纹理的矩形。如果该精灵是紧缩模式打包的图集,会引发异常。
textureRectOffset Gets the offset of the rectangle this sprite uses on its texture to the original sprite bounds. If sprite mesh type is FullRect, offset is zero
获取该精灵它使用纹理的矩形到原始精灵边界的偏移。如果精灵网格是FullRect,偏移则为零。

Static Functions 静态函数

CreateCreate a new Sprite object.
创建一个新的精灵对象。
script/unityengine/classes/sprite/sprite.txt · 最后更改: 2016/08/02 05:34 (外部编辑)