![]() | PropertyBackingFieldAttribute Class |
Namespace: Candlelight
public class PropertyBackingFieldAttribute : PropertyAttribute
The PropertyBackingFieldAttribute type exposes the following members.
Name | Description | |
---|---|---|
![]() | PropertyBackingFieldAttribute |
Initializes a new instance of the PropertyBackingFieldAttribute class that
uses the default PropertyDrawer for the field type. This constructor assumes that
the backing field name starts with "m_" or "_" and that the property name otherwise matches. For example, a
field m_Character or _Character could refer to either a property Character { get; set; } or a pair of
methods GetCharacter() and SetCharacter().
|
![]() | PropertyBackingFieldAttribute(String) |
Initializes a new instance of the PropertyBackingFieldAttribute class that
uses the default PropertyDrawer for the field type.
|
![]() | PropertyBackingFieldAttribute(Type, Object) |
Initializes a new instance of the PropertyBackingFieldAttribute class that should use a custom
PropertyDrawer associated with another PropertyAttribute
to display the decorated field in the inspector. This constructor assumes that the backing field name starts
with "m_" or "_" and that the property name otherwise matches. For example, a field m_Character or
_Character could refer to either a property Character { get; set; } or a pair of methods GetCharacter() and
SetCharacter().
|
![]() | PropertyBackingFieldAttribute(String, Type, Object) |
Initializes a new instance of the PropertyBackingFieldAttribute class that should use a custom
PropertyDrawer associated with another PropertyAttribute
to display the decorated field in the inspector.
|
Name | Description | |
---|---|---|
![]() | OverrideAttribute |
Gets an optional PropertyAttribute that specifies what
PropertyDrawer should be used for the decorated field.
|
![]() | PropertyName |
Gets the name of the property for which the decorated field is a backing field.
|
public class MyComponent : UnityEngine.MonoBehaviour { [UnityEngine.SerializeField, Candlelight.PropertyBackingField] private int m_MyInt = 0; public int MyInt { get { return m_MyInt; } set { m_MyInt = Mathf.Max(0, value); } } }
public class MyComponent : UnityEngine.MonoBehaviour { [UnityEngine.SerializeField, Candlelight.PropertyBackingField] private int m_MyInt = 0; public int GetMyInt() { return m_MyInt; } public void SetMyInt() { m_MyInt = Mathf.Max(0, value); } }