using UnityEngine;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
|
|
public class HideInPrefabAttribute : PropertyAttribute
|
|
{
|
|
|
|
}
|
|
|
|
[CustomPropertyDrawer(typeof(HideInPrefabAttribute))]
|
|
public class HideInPrefabDrawer : PropertyDrawer
|
|
{
|
|
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
PrefabType type = PrefabUtility.GetPrefabType(property.serializedObject.targetObject);
|
|
|
|
if (type != PrefabType.Prefab)
|
|
EditorGUI.PropertyField(position, property, label);
|
|
}
|
|
|
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
|
{
|
|
PrefabType type = PrefabUtility.GetPrefabType(property.serializedObject.targetObject);
|
|
if (type == PrefabType.Prefab)
|
|
return 0;
|
|
|
|
return base.GetPropertyHeight(property, label);
|
|
}
|
|
}
|