public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
      {
          _InitializeOptions();

          if (_transitionNames != null && _transitionNames.Length > 0)
          {
              using (EditorGUIPropertyBlock.BeginProperty(position, label, property))
              { position = EditorGUI.PrefixLabel(position, label);
               int selected = System.Array.IndexOf(_transitionNames, property.stringValue);

               if (selected < 0 || selected > _transitionNames.Length)
               {
                   selected = 0;
               }

               selected = EditorGUI.Popup(position, selected, _transitionNames);

               if (selected > 0)
               {
                   property.stringValue = _transitionNames[selected];
               }
               else
               {
                   property.stringValue = "";
               } }
          }
          else
          { //Default
              EditorGUI.PropertyField(position, property, label, true);
          }
      }
Beispiel #2
0
      public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
      {
          _InitializeOptions(property);

          if (_clipNamesList != null && _clipNamesList.Count > 0)
          {
              using (EditorGUIPropertyBlock.BeginProperty(position, label, property))
              { position = EditorGUI.PrefixLabel(position, label);
               int selected = _clipNamesList.IndexOf(property.stringValue);

               if (selected < 0 || selected > _clipNamesList.Count)
               {
                   selected = 0;
               }

               selected             = EditorGUI.Popup(position, selected, _clipNamesList.ToArray());
               property.stringValue = _clipNamesList[selected]; }
          }
          else
          { //Default behaviour
              EditorGUI.PropertyField(position, property, label, true);
          }
      }