using UnityEngine;
namespace Unity.VisualScripting
{
///
/// Gets the value of an object variable.
///
[UnitSurtitle("Object")]
public sealed class GetObjectVariable : GetVariableUnit, IObjectVariableUnit
{
public GetObjectVariable() : base() { }
public GetObjectVariable(string name) : base(name) { }
///
/// The source of the variable.
///
[DoNotSerialize]
[PortLabelHidden]
[NullMeansSelf]
public ValueInput source { get; private set; }
protected override void Definition()
{
source = ValueInput(nameof(source), null).NullMeansSelf();
base.Definition();
Requirement(source, value);
}
protected override VariableDeclarations GetDeclarations(Flow flow)
{
return Variables.Object(flow.GetValue(source));
}
}
}