1.2.0: Added AssignIfNull which allows for fields to get components from self or children

This commit is contained in:
Anders Ejlersen 2021-12-05 10:31:29 +01:00
parent 45411c018a
commit ea849a715d
6 changed files with 93 additions and 2 deletions

View 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;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dfd8ecaea012b084f994832dd519d850
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: