Canvas Is Root Canvas#
UI / Layout / Canvas / Canvas Is Root Canvas
Can Read
Cannot Write
Description#
The Is Root Canvas property of the Canvas 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.UI;
namespace VisualScript.Runtime
{
[Get]
[Title("Canvas Is Root Canvas")]
[Category("UI/Layout/Canvas/Is Root Canvas")]
[Description("The Is Root Canvas property of the Canvas component")]
[Image(typeof(IconCanvas), ColorTheme.Type.TextLight)]
[Keywords("UI, Layout")]
[Serializable]
public class GenTypeBool_Canvas_IsRootCanvas : TypeBool
{
[SerializeField] private GetGameObject m_Canvas = new GetGameObject(
new GenTypeGameObject_Canvas()
);
public override bool GetPreview(GameObject source)
{
GameObject instance = this.m_Canvas.GetPreview(source);
if (instance == null) return default;
Canvas component = instance.GetComponent<Canvas>();
return component != null ? component.isRootCanvas : default;
}
public override bool Get(Args args)
{
Canvas instance = this.m_Canvas.Get<Canvas>(args);
return instance != null
? instance.isRootCanvas
: default;
}
public override string ToString()
{
return $"{this.m_Canvas} Is Root Canvas";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}