This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
ARPlusSystem/ARPlusSystem-250418/Library/PackageCache/com.unity.xr.arfoundation@4.../Editor/PlaneDetectionModeAttribute...

28 lines
913 B
C#

using UnityEngine;
using UnityEngine.XR.ARFoundation;
namespace UnityEditor.XR.ARFoundation
{
/// <summary>
/// A custom property drawer for the <c>PlaneDetectionMode</c> enum.
/// </summary>
[CustomPropertyDrawer(typeof(PlaneDetectionModeMaskAttribute))]
class PlaneDetectionModeMaskAttributeDrawer : PropertyDrawer
{
string[] m_EnumNames;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// Remove the "None" option
if (m_EnumNames == null)
{
m_EnumNames = new string[property.enumNames.Length - 1];
for (int i = 1; i < property.enumNames.Length; ++i)
m_EnumNames[i - 1] = property.enumNames[i];
}
property.intValue = EditorGUI.MaskField(position, label, property.intValue, m_EnumNames);
}
}
}