Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active November 13, 2023 19:42
Show Gist options
  • Save unitycoder/879f4b676964345ab548 to your computer and use it in GitHub Desktop.
Save unitycoder/879f4b676964345ab548 to your computer and use it in GitHub Desktop.
Get Layernumber from Layermask
public LayerMask yourLayer = 1 << 10; // 10
gameObject.layer = (int)Mathf.Log(yourLayer.value, 2);
@unitycoder
Copy link
Author

LayerMask set initial value to "Default" or "Everything" or multiple layers
https://gist.github.com/unitycoder/17b82701f3e2f187eff9

@unitycoder
Copy link
Author

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