Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RenderSpriteToTexture2D(Sprite, int, int, Material, int, bool)

Renders a vector sprite to Texture2D.
Read time 1 minuteLast updated 12 days ago

Definition

public static Texture2D RenderSpriteToTexture2D(Sprite sprite, int width, int height, Material mat, int antiAliasing = 1, bool expandEdges = false)

Parameters

sprite

The sprite to render

width

The desired width of the resulting texture

height

The desired height of the resulting texture

The material used to render the sprite

antiAliasing

The number of samples per pixel for anti-aliasing

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

Texture2DA Texture2D object containing the rendered vector sprite