[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public class GameOption : Attribute
{
public MonoBehaviour target;
public FieldOrProperty property;
public virtual object value { get { return Get(target); } set { Set(target, value); } }
public object Get (object target)
{
if (target != null && property != null) return property.GetValue(target);
return null;
}
public T Get<T> () { return Get<T>(target); }
public T Get<T> (object target)
{
if (target != null && property != null) return property.GetValue<T>(target);
return default(T);
}
public virtual void Set (object target, object val)
{
if (isReadOnly || target == null) return;
if (property != null) property.SetValue(target, val);
}
}