Skip to content

Instantly share code, notes, and snippets.

@capnslipp
Last active April 12, 2022 09:39
Show Gist options
  • Select an option

  • Save capnslipp/8138106 to your computer and use it in GitHub Desktop.

Select an option

Save capnslipp/8138106 to your computer and use it in GitHub Desktop.
Unity HideInNormalInspector attribute
using UnityEngine;
public class HideInNormalInspectorAttribute : PropertyAttribute {}
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) {}
}
@mikelortega
Copy link

That's very interesting, but caution, it won't show elements in the editor with SerializedProperty serializedObject PropertyField, which is interesting to use with the new prefab workflow. Do you have any idea for a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment