Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CanvasRenderer

A component that will render to the screen after all normal rendering has completed when attached to a Canvas. Designed for GUI application.
Read time 8 minutesLast updated 4 days ago

Definition

public sealed class CanvasRenderer : Component

Remarks

Additional Resources:Canvas.

Properties

Property

Description

absoluteDepthDepth of the renderer relative to the root canvas.
clippingSoftnessThe clipping softness to apply to the renderer.
cullIndicates whether geometry emitted by this renderer is ignored.
cullTransparentMeshIndicates whether geometry emitted by this renderer can be ignored when the vertex color alpha is close to zero for every vertex of the mesh.
hasMovedTrue if any change has occured that would invalidate the positions of generated geometry.
hasPopInstructionEnable 'render stack' pop draw call.
hasRectClippingTrue if rect clipping has been enabled on this renderer. Additional Resources: CanvasRenderer.EnableRectClipping, CanvasRenderer.DisableRectClipping.
materialCountThe number of materials usable by this renderer.
popMaterialCountThe number of materials usable by this renderer. Used internally for masking.
relativeDepthDepth of the renderer realative to the parent canvas.

Methods

Method

Description

ClearRemove all cached vertices.
DisableRectClippingDisables rectangle clipping for this CanvasRenderer.
EnableRectClippingEnables rect clipping on the CanvasRendered. Geometry outside of the specified rect will be clipped (not rendered).
GetAlphaGet the current alpha of the renderer.
GetColorGet the current color of the renderer.
GetInheritedAlphaGet the final inherited alpha calculated by including all the parent alphas from included parent CanvasGroups.
GetMaterialGets the current Material assigned to the CanvasRenderer.
GetMeshReturns the current mesh used to render the canvas content into.
GetPopMaterialGets the current Material assigned to the CanvasRenderer. Used internally for masking.
GetSecondaryTextureGet the secondary texture at the specifed index.
GetSecondaryTextureCountGet the number of secondary textures usable by this renderer.
GetSecondaryTextureNameGet the shader property name of the secondary texture at the specifed index.
SetAlphaSet the alpha of the renderer. Will be multiplied with the UIVertex alpha and the Canvas alpha.
SetAlphaTextureThe Alpha Texture that will be passed to the Shader under the _AlphaTex property.
SetColorSet the color of the renderer. Will be multiplied with the UIVertex color and the Canvas color.
SetMaterialSet the material for the canvas renderer. If a texture is specified then it will be used as the 'MainTex' instead of the material's 'MainTex'. Additional Resources: CanvasRenderer.materialCount, CanvasRenderer.SetTexture.
SetMeshSets the Mesh used by this renderer. Note the Mesh must be read/write enabled.
SetPopMaterialSet the material for the canvas renderer. Used internally for masking.
SetSecondaryTextureSets the secondary texture usable by this renderer at the specified index with the specified shader property name.
SetSecondaryTextureCountSet the number of secondary textures usable by this renderer. If the size is increased then the new data is initialized with default empty values.
SetTextureSets the texture used by this renderer's material.

Static Methods

Method

Description

AddUIVertexStreamTake the Vertex stream and split it corrisponding arrays (positions, colors, uv0s, uv1s, normals and tangents).
CreateUIVertexStreamConvert a set of vertex components into a stream of UIVertex.
SplitUIVertexStreamsGiven a list of UIVertex, split the stream into it's component types.

Static Events

Member

Description

onRequestRebuild(Editor Only) Event that gets fired whenever the data in the CanvasRenderer gets invalidated and needs to be rebuilt.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.