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