UnityEngine.PropertyAttribute
to set property by a popup menu.
More...
Inherits PropertyAttribute.
Public Member Functions | |
PopupMenuAttribute (params object[] values) | |
Setup values of the menu. More... | |
PopupMenuAttribute (bool manual, params object[] values) | |
Setup values of the menu. More... | |
PopupMenuAttribute (object[] values, string[] options, bool manual=false) | |
Setup values and option names of the menu, show object.ToString() if an option is empty. More... | |
Public Attributes | |
readonly bool | manual |
Whether if to allow manual editing. More... | |
readonly object[] | values |
Values to select on menu. More... | |
readonly string[] | options |
Option names to display on menu. More... | |
UnityEngine.PropertyAttribute
to set property by a popup menu.
Only support types assignable to attribute, or deserializable by UnityEngine.JsonUtility
. Any specified option value can't be null
.
Note, this doesn't accept class, reference type, even serializable. 'Coz a reference value mustn't be directly assigned in, but generated by deserializing. It means the reference is changed everytime when the drawer was constructed. And, this sets the property to the first option and logs warning if the value isn't included. That happens when an invalid value is left in serialize system after script reload.
Declaring examples below, even used for UnityEngine.Color32
, or UnityEngine.Vector3
, etc.
It may become simpler if you implement WanzyeeStudio.Converter.BaseStringConverter
:
PopupMenuAttribute | ( | params object[] | values | ) |
Setup values of the menu.
values | Values to select on menu. |
PopupMenuAttribute | ( | bool | manual, |
params object[] | values | ||
) |
Setup values of the menu.
manual | Whether if to allow manual editing. |
values | Values to select on menu. |
PopupMenuAttribute | ( | object[] | values, |
string[] | options, | ||
bool | manual = false |
||
) |
Setup values and option names of the menu, show object.ToString()
if an option is empty.
values | Values to select on menu. |
options | Option names to display on menu. |
manual | Whether if to allow manual editing. |
readonly bool manual |
Whether if to allow manual editing.
readonly object [] values |
Values to select on menu.
readonly string [] options |
Option names to display on menu.