Method RenderSpriteToTexture2D
RenderSpriteToTexture2D(Sprite, int, int, Material, int, bool)
Renders a vector sprite to Texture2D.
Declaration
public static Texture2D RenderSpriteToTexture2D(Sprite sprite, int width, int height, Material mat, int antiAliasing = 1, bool expandEdges = false)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite | The sprite to render |
int | width | The desired width of the resulting texture |
int | height | The desired height of the resulting texture |
Material | mat | The material used to render the sprite |
int | antiAliasing | The number of samples per pixel for anti-aliasing |
bool | expandEdges | When true, expand the edges to avoid a dark banding effect caused by filtering. This is slower to render and uses more graphics memory. |
Returns
Type | Description |
---|---|
Texture2D | A Texture2D object containing the rendered vector sprite |