Method DuplicateTexture
|
Edit this page
View Source
DuplicateTexture(Texture2D, Rect)
Creates a readable copy of a rectangular region from a Texture2D.
Declaration
public static Texture2D DuplicateTexture(Texture2D texture, Rect textureRect)
Parameters
| Type |
Name |
Description |
| Texture2D |
texture |
Source texture. |
| Rect |
textureRect |
Region of the texture to copy. |
Returns
| Type |
Description |
| Texture2D |
A readable Texture2D of the specified region, or null if the texture is null. |
|
Edit this page
View Source
DuplicateTexture(Texture2D)
Creates a readable copy of a Texture2D.
Declaration
public static Texture2D DuplicateTexture(Texture2D texture)
Parameters
| Type |
Name |
Description |
| Texture2D |
texture |
Source texture. |
Returns
| Type |
Description |
| Texture2D |
A readable copy of the texture, or null if the texture is null. |
|
Edit this page
View Source
DuplicateTexture(Sprite)
Creates a readable copy of a Sprite's texture region.
If the sprite is part of an atlas, only its texture rectangle is copied.
Use AssetUtils.DuplicateTexture(sprite.texture) to copy the full texture.
Declaration
public static Texture2D DuplicateTexture(Sprite sprite)
Parameters
| Type |
Name |
Description |
| Sprite |
sprite |
Source sprite. |
Returns
| Type |
Description |
| Texture2D |
A readable Texture2D of the sprite’s texture region, or null if the texture is null. |