unity-atoms/Source/Base/ScriptableObjectReference.cs
Soraphis 97fcf763eb Fixed the ReferenceDrawer for SceneFields.
Fixed the ReferenceDrawer for any field
2019-05-04 11:49:35 +02:00

36 lines
830 B
C#

namespace UnityAtoms
{
public abstract class ScriptableObjectReference{}
public abstract class ScriptableObjectReference<T, V> : ScriptableObjectReference
where V : ScriptableObjectVariableBase<T>
{
public bool UseConstant;
public T ConstantValue;
public V Variable;
protected ScriptableObjectReference()
{
UseConstant = true;
}
protected ScriptableObjectReference(T value) : this()
{
UseConstant = true;
ConstantValue = value;
}
public T Value
{
get { return UseConstant ? ConstantValue : Variable.Value; }
}
public static implicit operator T(ScriptableObjectReference<T, V> reference)
{
return reference.Value;
}
}
}