I’d like to set the skin for a LayerMask field in the inspector.
EditorGUILayout.PropertyField draws the correct field, but doesn’t provide a parameter for style:
I think I need to use the MaskField to get what I want:
EditorGUILayout.MaskField(label, property.intValue, names, style);
This approach looks fine at first glance, but it opens a whole can of worms. Namely: how do I correctly generate the string array of layer names?
I can loop over the 32 layers and get strings for each, but any undefined layers show up as empty strings:
I can write logic to build a string array containing only non-empty strings, but then the generated mask is wrong, I need to pull it apart and remap it to the LayerMask.
This is a lot of work just to set the style for a LayerMask field, so I’m inclined to believe I’m going about this the wrong way.
Can anyone point me in the correct direction to set the style for a LayerMask?