Skip to content

Instantly share code, notes, and snippets.

@beardordie
Created July 14, 2019 00:46
Show Gist options
  • Save beardordie/b152942606ddc97c1d623eb56267b4bc to your computer and use it in GitHub Desktop.
Save beardordie/b152942606ddc97c1d623eb56267b4bc to your computer and use it in GitHub Desktop.
Unity - use LayerMask with collision
public LayerMask layerMask;
private void OnTriggerEnter(Collider other)
{
if (((1 << other.gameObject.layer) & layerMask) != 0)
{
// Do stuff
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment