예제 #1
0
        public static LayerMask MappedMaskField(string label, LayerMask current, LayerMask layers)
        {
            string[] map;

            map = layers.MaskToNames(LayerMaskExtension.AllLayerNames());

            return(EditorGUILayoutExtension.MappedMaskField(label, current, map));
        }
예제 #2
0
        public static LayerMask MappedMaskField(string label, LayerMask current, string[] map)
        {
            string[]  all;
            LayerMask mask;

            if (map.Length == 0)
            {
                return((LayerMask)0);
            }

            all = LayerMaskExtension.AllLayerNames();

            // "current" comes from all existing layers -> 'casted' to map specified layers
            mask = current.CastTo(all, map);
            // display map specified layers, can select them
            mask = EditorGUILayout.MaskField(label, mask, map);
            // "mask" is on map layers -> 'cast' it on all existing layers
            mask = mask.CastTo(map, all);

            return(mask);
        }