Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Renderer

General functionality for all renderers.
Read time 8 minutesLast updated 2 days ago

Definition

[RequireComponent(typeof(Transform))]public class Renderer : Component

Remarks

A renderer is what makes an object appear on the screen. Use this class to access the renderer of any object, mesh or Particle System. Renderers can be disabled to make objects invisible (see Renderer.enabled), and the materials can be accessed and modified through them (see Renderer.material).
Additional Resources: Renderer components for meshes, particles, lines and trails.

Properties

Property

Description

allowOcclusionWhenDynamicControls if dynamic occlusion culling should be performed for this renderer.
boundsThe bounding box of the renderer in world space.
enabledMakes the rendered 3D object visible if enabled.
forceMeshLodForce a specific Mesh LOD level for this renderer if the mesh has Mesh LODs. If the value is -1, Unity uses the default Mesh LOD selection method.
forceRenderingOffAllows turning off rendering for a specific component.
isLOD0Is the renderer the first LOD level in its group.
isPartOfStaticBatchIndicates whether the renderer is part of a static batch with other renderers.
isVisibleIs this renderer visible in any camera? (Read Only)
lightmapIndexThe index of the baked lightmap applied to this renderer.
lightmapScaleOffsetThe UV scale & offset used for a lightmap.
lightProbeProxyVolumeOverrideIf set, the Renderer will use the Light Probe Proxy Volume component attached to the source GameObject.
lightProbeUsageThe light probe interpolation type.
localBoundsThe bounding box of the renderer in local space.
localToWorldMatrixMatrix that transforms a point from local space into world space (Read Only).
LODGroupThe LODGroup for this Renderer.
lodGroupMaskThe LOD levels of the owning LODGroup that use this Renderer, as a bit mask.
materialReturns the first instantiated Material assigned to the renderer.
materialsReturns all the instantiated materials of this object.
meshLodSelectionBiasBias to add to the calculated value when selecting a Mesh LOD level.
motionVectorGenerationModeSpecifies the mode for motion vector rendering.
probeAnchorIf set, Renderer will use this Transform's position to find the light or reflection probe.
rayTracingAccelerationStructureBuildFlagsThe flags Unity uses when it builds acceleration structures associated with geometry used by renderers.
rayTracingAccelerationStructureBuildFlagsOverrideWhether to override the default build flags specified when creating a RayTracingAccelerationStructure.
rayTracingModeDescribes how this renderer is updated for ray tracing.
receiveShadowsDoes this object receive shadows?
reflectionProbeUsageShould reflection probes be used for this Renderer?
rendererPriorityThis value sorts renderers by priority. Lower values are rendered first and higher values are rendered last.
renderingLayerMaskDetermines which rendering layer this renderer lives on, if you use a scriptable render pipeline.
shadowCastingModeDoes this object cast shadows?
sharedMaterialThe shared material of this object.
sharedMaterialsAll the shared materials of this object.
sortingLayerIDUnique ID of the Renderer's sorting layer.
sortingLayerNameName of the Renderer's sorting layer.
sortingOrderRenderer's order within a sorting layer.
staticShadowCasterIs this renderer a static shadow caster?
worldToLocalMatrixMatrix that transforms a point from world space into local space (Read Only).

Methods

Method

Description

GetClosestReflectionProbesReturns an array of closest reflection probes with weights, weight shows how much influence the probe has on the renderer, this value is also used when blending between reflection probes occur.
GetMaterialsReturns all the instantiated materials of this object.
GetPropertyBlockGet per-Renderer or per-Material property block.
GetSharedMaterialsReturns all the shared materials of this object.
HasPropertyBlockReturns true if the Renderer has a material property block attached via SetPropertyBlock.
OnBecameInvisibleOnBecameInvisible is called when the object is no longer visible by any camera.
OnBecameVisibleOnBecameVisible is called when the object became visible by any camera.
ResetBoundsReset custom world space bounds.
ResetLocalBoundsReset custom local space bounds.
SetMaterialsAssigns the shared materials of this renderer using the list of materials provided.
SetPropertyBlockLets you set or clear per-renderer or per-material parameter overrides.
SetSharedMaterialsAssigns the shared materials of this renderer using the list of materials provided.

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.