Canvas Target Display#
UI / Layout / Canvas / Canvas Target Display
Can Read
Can Write
Description#
The Target Display 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]
[Set]
[Title("Canvas Target Display")]
[Category("UI/Layout/Canvas/Target Display")]
[Description("The Target Display property of the Canvas component")]
[Image(typeof(IconCanvas), ColorTheme.Type.TextLight)]
[Keywords("UI, Layout")]
[Serializable]
public class GenTypeInteger_Canvas_TargetDisplay : TypeNumber
{
[SerializeField] private GetGameObject m_Canvas = new GetGameObject(
new GenTypeGameObject_Canvas()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_Canvas.GetPreview(source);
if (instance == null) return default;
Canvas component = instance.GetComponent<Canvas>();
return component != null ? component.targetDisplay : default;
}
public override double Get(Args args)
{
Canvas instance = this.m_Canvas.Get<Canvas>(args);
return instance != null
? instance.targetDisplay
: default;
}
public override void Set(double value, Args args)
{
Canvas component = this.m_Canvas.Get<Canvas>(args);
if (component != null) component.targetDisplay = (int) value;
}
public override string ToString()
{
return $"{this.m_Canvas} Target Display";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}