IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
EnumFlags.cs
1 //======= Copyright (c) Valve Corporation, All rights reserved. ===============
2 //
3 // Purpose: Allows Enums to be shown in the inspector as flags
4 //
5 //=============================================================================
6 
7 using UnityEngine;
8 #if UNITY_EDITOR
9 using UnityEditor;
10 #endif
11 
12 namespace Valve.VR.InteractionSystem
13 {
14  //-------------------------------------------------------------------------
15  public class EnumFlags : PropertyAttribute
16  {
17  public EnumFlags() { }
18  }
19 
20 
21 #if UNITY_EDITOR
22  //-------------------------------------------------------------------------
23  [CustomPropertyDrawer( typeof( EnumFlags ) )]
24  public class EnumFlagsPropertyDrawer : PropertyDrawer
25  {
26  public override void OnGUI( Rect position, SerializedProperty property, GUIContent label )
27  {
28  property.intValue = EditorGUI.MaskField( position, label, property.intValue, property.enumNames );
29  }
30  }
31 #endif
32 }