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