Sprite.Create(Texture2D texture, Rect rect, Vector2 pivot, number pixelsPerUnit)⚓︎
Create a new Sprite object.
Parameters:⚓︎
Name | Type | Description |
---|---|---|
texture | Texture2D | The Texture to obtain the Sprite graphic from. |
rect | Rect | The rectangular section of the Texture to use for the Sprite. |
pivot | Vector2 | The Sprite's pivot point relative to its graphic rectangle. |
pixelsPerUnit | number | The number of pixels in the Sprite that correspond to one unit in world space. |
Returns:⚓︎
type | Description |
---|---|
Sprite | new Sprite object. |
Usage⚓︎
---@type Texture2D
local texture;
---@type Rect
local rect;
---@type Vector2
local pivot;
---@type number
local pixelsPerUnit;
local val0 = Sprite:Create(texture, rect, pivot, pixelsPerUnit)
Returns:⚓︎
type | Description |
---|---|
Sprite | new Sprite object. |
Usage⚓︎
---@type Texture2D
local texture;
---@type Rect
local rect;
---@type Vector2
local pivot;
---@type number
local pixelsPerUnit;
---@type number
local extrude;
---@type SpriteMeshType
local meshType;
---@type Vector4
local border;
local val0 = Sprite:Create(texture, rect, pivot, pixelsPerUnit, extrude, meshType, border)
---@type number local extrude;
---@type SpriteMeshType local meshType;
---@type Vector4 local border;
---@type boolean local generateFallbackPhysicsShape;
local val0 = Sprite:Create(texture, rect, pivot, pixelsPerUnit, extrude, meshType, border, generateFallbackPhysicsShape) ```