Aspect Ratio Fitter Aspect Ratio#
UI / Layout / Aspect Ratio Fitter / Aspect Ratio Fitter Aspect Ratio
Can Read
Can Write
Description#
The Aspect Ratio property of the Aspect Ratio Fitter 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("Aspect Ratio Fitter Aspect Ratio")]
[Category("UI/Layout/Aspect Ratio Fitter/Aspect Ratio")]
[Description("The Aspect Ratio property of the Aspect Ratio Fitter component")]
[Image(typeof(IconAspectRatioFitter), ColorTheme.Type.TextLight)]
[Keywords("UI, Layout")]
[Serializable]
public class GenTypeNumber_AspectRatioFitter_AspectRatio : TypeNumber
{
[SerializeField] private GetGameObject m_AspectRatioFitter = new GetGameObject(
new GenTypeGameObject_AspectRatioFitter()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_AspectRatioFitter.GetPreview(source);
if (instance == null) return default;
AspectRatioFitter component = instance.GetComponent<AspectRatioFitter>();
return component != null ? component.aspectRatio : default;
}
public override double Get(Args args)
{
AspectRatioFitter instance = this.m_AspectRatioFitter.Get<AspectRatioFitter>(args);
return instance != null
? instance.aspectRatio
: default;
}
public override void Set(double value, Args args)
{
AspectRatioFitter component = this.m_AspectRatioFitter.Get<AspectRatioFitter>(args);
if (component != null) component.aspectRatio = (float) value;
}
public override string ToString()
{
return $"{this.m_AspectRatioFitter} Aspect Ratio";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}