文档

Unity Engine

Unity Engine

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

Renders a vector sprite to Texture2D.
阅读时间1 分钟最后更新于 1 个月前

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