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