Canvas Scaler Fallback Screen DPI#
UI / Layout / Canvas Scaler / Canvas Scaler Fallback Screen DPI
Can Read
Can Write
Description#
The Fallback Screen DPI property of the Canvas Scaler 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 Scaler Fallback Screen DPI")]
[Category("UI/Layout/Canvas Scaler/Fallback Screen DPI")]
[Description("The Fallback Screen DPI property of the Canvas Scaler component")]
[Image(typeof(IconCanvasScaler), ColorTheme.Type.TextLight)]
[Keywords("UI, Layout")]
[Serializable]
public class GenTypeNumber_CanvasScaler_FallbackScreenDPI : TypeNumber
{
[SerializeField] private GetGameObject m_CanvasScaler = new GetGameObject(
new GenTypeGameObject_CanvasScaler()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_CanvasScaler.GetPreview(source);
if (instance == null) return default;
CanvasScaler component = instance.GetComponent<CanvasScaler>();
return component != null ? component.fallbackScreenDPI : default;
}
public override double Get(Args args)
{
CanvasScaler instance = this.m_CanvasScaler.Get<CanvasScaler>(args);
return instance != null
? instance.fallbackScreenDPI
: default;
}
public override void Set(double value, Args args)
{
CanvasScaler component = this.m_CanvasScaler.Get<CanvasScaler>(args);
if (component != null) component.fallbackScreenDPI = (float) value;
}
public override string ToString()
{
return $"{this.m_CanvasScaler} Fallback Screen DPI";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}