blob: 0b2d4d4ac0b5c1a7e6a8006475ca3d3ad912f0b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Cristian Pop - https://boxophobic.com/
using UnityEngine;
using UnityEditor;
namespace Boxophobic.StyledGUI
{
[CustomPropertyDrawer(typeof(StyledPopupLayers))]
public class StyledPopupLayersAttributeDrawer : PropertyDrawer
{
private int index;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
index = property.intValue;
string[] allLayers = new string[32];
for (int i = 0; i < 32; i++)
{
if (LayerMask.LayerToName(i).Length < 1)
{
allLayers[i] = "Missing";
}
else
{
allLayers[i] = LayerMask.LayerToName(i);
}
}
index = EditorGUILayout.Popup(property.displayName, index, allLayers);
property.intValue = index;
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return -2;
}
}
}
|