using UnityEngine;
namespace Unity.VisualScripting
{
///
/// Checks if an object variable is defined.
///
[UnitSurtitle("Object")]
public sealed class IsObjectVariableDefined : IsVariableDefinedUnit, IObjectVariableUnit
{
public IsObjectVariableDefined() : base() { }
public IsObjectVariableDefined(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, isDefined);
}
protected override VariableDeclarations GetDeclarations(Flow flow)
{
return Variables.Object(flow.GetValue(source));
}
}
}