Last active
July 5, 2024 15:43
-
-
Save unitycoder/17b82701f3e2f187eff9 to your computer and use it in GitHub Desktop.
LayerMask set initial value to "Default" or "Everything" or multiple layers
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 = 1 << 0; // default layer (0) | |
public LayerMask layerMask2 = ~0; // everything | |
public LayerMask layerMask2b = -1; // everything | |
public LayerMask layerMask3 = default;// nothing | |
public LayerMask layerMask4 = 0;// nothing | |
public LayerMask layerMask4b; // nothing | |
public LayerMask layerMask5 = 1 << 5;// layer 5 (UI) | |
public LayerMask layerMask6 = 1 << 2 | 1 << 5;// Ignore Raycast (Layer 2) AND UI (Layer 5) | |
public LayerMask layerMask7 = ~(1 << 4 | 1 << 5); // all except layer 4 and 5 | |
public LayerMask layerMask8 = ~(1 << 4); // all except layer 4 | |
Check if Layer Exists (by name), Assign Gameobject to layer using LayerMask
https://gist.github.com/unitycoder/65f604895f1699b92af1ba7762bfab45
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get Layernumber from Layermask
https://gist.github.com/unitycoder/879f4b676964345ab548