Skip to content

Instantly share code, notes, and snippets.

@andyman
Created January 20, 2017 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyman/cac0790f3751f07d9b62a1875a3ce5d9 to your computer and use it in GitHub Desktop.
Save andyman/cac0790f3751f07d9b62a1875a3ce5d9 to your computer and use it in GitHub Desktop.
A simple Layer Mask Utility class for Unity for checking whether a layer is in a layermask
using UnityEngine;
using System.Collections;
public class LayerMaskUtil {
public static bool CheckLayer(int layer, LayerMask layerMask)
{
return (layerMask.value & (1 << layer)) != 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment