Singularity/Library/PackageCache/com.unity.visualscripting@1.../Runtime/VisualScripting.Flow/Framework/Variables/UnifiedVariableUnit.cs

40 lines
1.0 KiB
C#
Raw Permalink Normal View History

2024-05-06 14:45:45 -04:00
using UnityEngine;
namespace Unity.VisualScripting
{
[SpecialUnit]
public abstract class UnifiedVariableUnit : Unit, IUnifiedVariableUnit
{
/// <summary>
/// The kind of variable.
/// </summary>
[Serialize, Inspectable, UnitHeaderInspectable]
public VariableKind kind { get; set; }
/// <summary>
/// The name of the variable.
/// </summary>
[DoNotSerialize]
[PortLabelHidden]
public ValueInput name { get; private set; }
/// <summary>
/// The source of the variable.
/// </summary>
[DoNotSerialize]
[PortLabelHidden]
[NullMeansSelf]
public ValueInput @object { get; private set; }
protected override void Definition()
{
name = ValueInput(nameof(name), string.Empty);
if (kind == VariableKind.Object)
{
@object = ValueInput<GameObject>(nameof(@object), null).NullMeansSelf();
}
}
}
}