module-inspector/Runtime/ValueModifiers/AssignIfNullAttribute.cs

36 lines
919 B
C#

using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class AssignIfNullAttribute : ValueModifierPropertyAttribute
{
public readonly bool useType;
public readonly Type type;
public readonly bool includeChildren;
public AssignIfNullAttribute()
{
useType = false;
}
public AssignIfNullAttribute(bool includeChildren)
{
useType = false;
this.includeChildren = includeChildren;
}
public AssignIfNullAttribute(Type type)
{
this.type = type;
useType = true;
}
public AssignIfNullAttribute(Type type, bool includeChildren)
{
this.type = type;
this.includeChildren = includeChildren;
useType = true;
}
}
}