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.

16 lines
689 B

  1. namespace VRTK
  2. {
  3. using UnityEngine;
  4. using UnityEditor;
  5. using System;
  6. [CustomPropertyDrawer(typeof(ObsoleteInspectorAttribute))]
  7. class ObsoleteInspectorDrawer : PropertyDrawer
  8. {
  9. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  10. {
  11. ObsoleteAttribute obsoleteAttribute = (ObsoleteAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(ObsoleteAttribute));
  12. EditorStyles.label.richText = true;
  13. EditorGUI.PropertyField(position, property, new GUIContent("<color=red><i>" + label.text + "</i></color>", "**OBSOLETE**\n\n" + obsoleteAttribute.Message), true);
  14. }
  15. }
  16. }