Selectable Target Graphic#
UI / Interaction / Selectable / Selectable Target Graphic
Can Read
Can Write
Description#
The Target Graphic property of the Selectable 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("Selectable Target Graphic")]
[Category("UI/Interaction/Selectable/Target Graphic")]
[Description("The Target Graphic property of the Selectable component")]
[Image(typeof(IconSelectable), ColorTheme.Type.TextLight)]
[Keywords("UI, User, Interface")]
[Serializable]
public class GenTypeGameObject_Selectable_TargetGraphic : TypeGameObject
{
[SerializeField] private GetGameObject m_Selectable = new GetGameObject(
new GenTypeGameObject_Selectable()
);
public override GameObject GetPreview(GameObject source)
{
GameObject instance = this.m_Selectable.GetPreview(source);
if (instance == null) return default;
Selectable component = instance.GetComponent<Selectable>();
return component != null ? component.targetGraphic.gameObject : default;
}
public override GameObject Get(Args args)
{
Selectable instance = this.m_Selectable.Get<Selectable>(args);
return instance != null
? instance.targetGraphic.gameObject
: default;
}
public override U Get<U>(Args args)
{
if (typeof(U) == typeof(Selectable))
{
Selectable instance = this.m_Selectable.Get<Selectable>(args);
return instance != null
? instance.targetGraphic as U
: default;
}
return base.Get<U>(args);
}
public override void Set(GameObject value, Args args)
{
Selectable component = this.m_Selectable.Get<Selectable>(args);
if (component != null) component.targetGraphic = (Graphic) value.Get<UnityEngine.UI.Graphic>();
}
public override void Set<U>(U value, Args args)
{
if (typeof(U) == typeof(Graphic))
{
Selectable component = this.m_Selectable.Get<Selectable>(args);
if (component != null) component.targetGraphic = value as Graphic;
}
base.Set<U>(value, args);
}
public override string ToString()
{
return $"{this.m_Selectable} Target Graphic";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}