public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            ColliderOptions colliderOptions = (ColliderOptions)EditorHelper.GetTargetObjectOfProperty(property);

            EditorGUI.BeginProperty(position, null, property);
            var colliderTypeLabel = new GUIContent
            {
                text    = "Collider Type",
                tooltip = "The type of collider added to game objects in this layer."
            };
            var colliderTypeProperty = property.FindPropertyRelative("colliderType");

            var displayNames = colliderTypeProperty.enumDisplayNames;
            int count        = colliderTypeProperty.enumDisplayNames.Length;

            if (!isGUIContentSet)
            {
                colliderTypeContent = new GUIContent[count];
                for (int extIdx = 0; extIdx < count; extIdx++)
                {
                    colliderTypeContent[extIdx] = new GUIContent
                    {
                        text    = displayNames[extIdx],
                        tooltip = EnumExtensions.Description((ColliderType)extIdx),
                    };
                }
                isGUIContentSet = true;
            }

            colliderTypeProperty.enumValueIndex = EditorGUILayout.Popup(colliderTypeLabel, colliderTypeProperty.enumValueIndex, colliderTypeContent);
            EditorHelper.CheckForModifiedProperty(colliderTypeProperty, colliderOptions);

            EditorGUI.EndProperty();
        }
Пример #2
0
 public override void SetProperties(ModifierProperties properties)
 {
     _options = (ColliderOptions)properties;
     _options.PropertyHasChanged += UpdateModifier;
 }
Пример #3
0
 public override void SetProperties(ModifierProperties properties)
 {
     _options = (ColliderOptions)properties;
 }