Last active
April 12, 2022 09:39
-
-
Save capnslipp/8138106 to your computer and use it in GitHub Desktop.
Unity HideInNormalInspector attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class HideInNormalInspectorAttribute : PropertyAttribute {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEditor; | |
| [CustomPropertyDrawer(typeof(HideInNormalInspectorAttribute))] | |
| class HideInNormalInspectorDrawer : PropertyDrawer | |
| { | |
| public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { | |
| return 0f; | |
| } | |
| public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's very interesting, but caution, it won't show elements in the editor with
SerializedPropertyserializedObjectPropertyField, which is interesting to use with the new prefab workflow. Do you have any idea for a workaround?