Exemplo n.º 1
0
        static public void MsgTypeField(Rect position, SerializedProperty property, GUIContent label, FilteredMsgTypeList msgTypes)
        {
            var valueProp   = property.FindPropertyRelative("m_Value");
            int currentHash = valueProp.intValue;

            EditorGUI.BeginChangeCheck();
            int currentIndex = msgTypes.FindIndexByHash(currentHash);
            int newIndex     = EditorGUI.Popup(position, label, currentIndex, msgTypes.PopupContent, EditorStyles.popup);

            if (EditorGUI.EndChangeCheck() && newIndex != currentIndex)
            {
                valueProp.intValue = msgTypes.FindHashByIndex(newIndex);
            }
        }