Created
July 14, 2019 00:46
-
-
Save beardordie/b152942606ddc97c1d623eb56267b4bc to your computer and use it in GitHub Desktop.
Unity - use LayerMask with collision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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