• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Renderer

    Inherits from: Component

    The Renderer class in Unity serves as the control center for displaying and customizing 3D objects. Integral to creating immersive game environments, it's the stage director that dictates how each Mesh object appears on the screen.

    Employing the power of Materials and their attached Shaders, the Renderer class not only determines what you see on the screen but how you see it. It shapes the visual attributes of every object from their color and texture to their response to lighting, painting a visual symphony for players to interact with. Renderer is the foundational base to the functional renderers you will be using like Class.MeshRenderer or Class.TrailRenderer.

    This class is the secret sauce in delivering visually compelling and immersive gaming experiences. Take a deeper exploration into its capabilities with the official Unity Renderer documentation. It reveals the nitty-gritty of leveraging this class effectively in Unity game creation.

    Properties

    The bounds property is a read-only attribute that provides the access-aligned 3D bounding box that fully encompasses the object in the world space. More details here.

    The localBounds property is a read-only attribute that aids in obtaining the local bounding volume of the Renderer. Explore more.

    enabled

    boolean

    The enabled property determines whether this renderer is enabled or not. If false, Renderer will not produce any rendering output. Learn more.

    isVisible

    boolean

    The isVisible property indicates whether the Renderer is visible from any camera. Click here for more details.

    receiveShadows property is a toggle to control whether the object will receive shadows by casting objects. For additional details, refer here.

    If forceRenderingOff is true, rendering is forced off and will not be updated. This might be used for complex scenarios where you need full control over the rendering. More information is available here.

    In case staticShadowCaster is set to true, Renderer will be part of static shadow caster culling even though it is a dynamic Renderer. More details can be found here.

    renderingLayerMask represents custom Light Layer this Renderer uses. For more details, see this documentation.

    The rendererPriority property allows you to override the render order for this particular Renderer. Find out more at this link.

    sortingLayerName controls the name of the Renderer's sorting layer. More information can be found here.

    sortingLayerID gives read/write access to the unique ID for the Renderer's sorting layer. Read more here.

    sortingOrder property controls the Renderer's place in its sorting layer. More information can be found at this documentation page.

    allowOcclusionWhenDynamic is a toggle for advanced use. If true, dynamic occlusion culling will be performed for this Renderer. More information can be found here.

    The read-only property isPartOfStaticBatch determines if this Renderer is part of a static batch. To get more insights into this property, refer to the official Unity documentation.

    worldToLocalMatrix property provides a matrix that transforms a point from world space into local space. Refer to the official Unity documentation for a deeper understanding of this property.

    localToWorldMatrix property gives a matrix that transforms a point from local space into world space. For further information, review the official Unity documentation.

    The GameObject assigned to lightProbeProxyVolumeOverride property will provide light probe Proxy Volume’s settings to this Renderer. More details can be found at this link.

    The GameObject assigned to probeAnchor property will be used to find the light or reflection probe. If nothing is assigned, the Renderer’s GameObject’s Transform will be used for this. For more details, consult the official Unity documentation.

    lightmapIndex allows you to set a specific lightmap to this Renderer. Here is more information on this.

    realtimeLightmapIndex property provides the ability to set a specific real-time lightmap to use for this Renderer. Read more on this here.

    lightmapScaleOffset is a four-dimensional vector that modifies how the object blends with static lightmaps. More information about this can be found here.

    realtimeLightmapScaleOffset is a four-dimensional vector property that modifies how 3D objects blend with real-time lightmaps. You can find extensive detail on this property here.

    material property allows getting or setting the material to the renderer dynamically at runtime. Note that this creates a new instance of the material, impacting performance and memory. Learn more about the usage of the 'material' property here.

    With sharedMaterial property, it lets you directly access the material used by the renderer. This avoids creating a new instance of the material and is more performance-friendly. Find more about this material here.

    Methods

    This method updates the bounding volume of the renderer (Bounds property) to fully encapsulate the rendered content, including modifications done in the LateUpdate callbacks. Get more insights here.

    Returns

    void

    This method doesn't return any value.

    The ResetLocalBounds method forcefully updates the local bounding volume of the renderer. It's compulsory to call this manually after changing the geometry of the rendered object. More on this can be found here.

    Returns

    void

    This method doesn't return any value.

    HasPropertyBlock method checks if the renderer has a MaterialPropertyBlock assigned to it. MaterialPropertyBlocks are used for changing the material properties without instancing materials. Read more about this method here.

    Returns

    boolean

    Returns true if the Renderer has a MaterialPropertyBlock, otherwise false.

    Updated 2 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.