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