Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
903 B

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