1.2.0: Added AssignIfNull which allows for fields to get components from self or children
This commit is contained in:
parent
45411c018a
commit
ea849a715d
6 changed files with 93 additions and 2 deletions
36
Runtime/ValueModifiers/AssignIfNullAttribute.cs
Normal file
36
Runtime/ValueModifiers/AssignIfNullAttribute.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/ValueModifiers/AssignIfNullAttribute.cs.meta
Normal file
11
Runtime/ValueModifiers/AssignIfNullAttribute.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dfd8ecaea012b084f994832dd519d850
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue