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.
34 lines
1.1 KiB
34 lines
1.1 KiB
namespace Mapbox.Editor
|
|
{
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using Mapbox.Unity.Map;
|
|
|
|
[CustomPropertyDrawer(typeof(UnityLayerOptions))]
|
|
public class UnityLayerOptionsDrawer : PropertyDrawer
|
|
{
|
|
static float lineHeight = EditorGUIUtility.singleLineHeight;
|
|
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
var addtoLayerProp = property.FindPropertyRelative("addToLayer");
|
|
EditorGUI.BeginProperty(position, label, property);
|
|
|
|
EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, lineHeight), addtoLayerProp, new GUIContent { text = "Add to Unity layer" });
|
|
if (addtoLayerProp.boolValue == true)
|
|
{
|
|
EditorGUI.indentLevel++;
|
|
var layerId = property.FindPropertyRelative("layerId");
|
|
layerId.intValue = EditorGUILayout.LayerField("Layer", layerId.intValue);
|
|
EditorGUI.indentLevel--;
|
|
}
|
|
|
|
EditorGUI.EndProperty();
|
|
}
|
|
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
|
{
|
|
// Reserve space for the total visible properties.
|
|
return 1.0f * lineHeight;
|
|
}
|
|
}
|
|
} |