LayerMaskExtensions

Author: Michael Garforth

Overview
This C# class gives simple extension access to manipulating and debugging LayerMasks.

Due to the way UnityScript/Javascript compiles extension methods, it's not accessible in the same way, so you need to call the functions with the class name and the first parameter as the instance, for example LayerMaskExtensions.AddToMask(mask, names)

Use
Note - layerMask below refers to a LayerMask instance, LayerMaskExtensions to the class name itself

LayerMaskExtensions.Create(params string[] names) -  Creates a new LayerMask from a variable number of layer names

LayerMaskExtensions.Create(params int[] layerNumbers) -  Creates a new LayerMask from a variable number of layer numbers

LayerMaskExtensions.NamesToMask(params string[] names) -  Same as Create

LayerMaskExtensions.LayerNumbersToMask(params int[] layerNumbers) -  Same as Create

layerMask.Inverse -  Returns the inverse of the mask

layerMask.AddToMask(params string[] names) -  Returns a new LayerMask with the specified layers added

layerMask.RemoveFromMask(params string[] names) -  Returns a new LayerMask with the specified layers removed

layerMask.MaskToNames -  Returns a string array with the layer names from the mask

layerMask.MaskToString -  Returns a string with the layer names from the mask, delimited by comma

layerMask.MaskToString(string delimiter) -  Returns a string with the layer names from the mask, delimited by the specified delimiter

C# - LayerMaskExtensions.cs
The script should be named LayerMaskExtensions.cs