Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Canvas Renderer Relative Depth#

Rendering / Canvas Renderer / Canvas Renderer Relative Depth

  • Can Read

  • Cannot Write

Description#

The Relative Depth property of the Canvas Renderer component

Code#

// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.Rendering;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Canvas Renderer Relative Depth")]
    [Category("Rendering/Canvas Renderer/Relative Depth")]
    [Description("The Relative Depth property of the Canvas Renderer component")]
    
    [Image(typeof(IconEye), ColorTheme.Type.TextLight)]
    
    [Serializable]
    public class GenTypeInteger_CanvasRenderer_RelativeDepth : TypeNumber
    {
        [SerializeField] private GetGameObject m_CanvasRenderer = new GetGameObject(
            new GenTypeGameObject_CanvasRenderer()
        );
        
        public override double GetPreview(GameObject source)
        {
            GameObject instance = this.m_CanvasRenderer.GetPreview(source);
            if (instance == null) return default;
            
            CanvasRenderer component = instance.GetComponent<CanvasRenderer>();
            return component != null ? component.relativeDepth : default;
        }
        
        public override double Get(Args args)
        {
            CanvasRenderer instance = this.m_CanvasRenderer.Get<CanvasRenderer>(args);
            return instance != null
                ? instance.relativeDepth
                : default;
        }
        
        public override string ToString()
        {
            return $"{this.m_CanvasRenderer} Relative Depth";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.