I wrote a class so I would never have to get used to using LayerMask again, because for some reason I find it hard to remember how bitmasks work and how to use them. The class helps construct LayerMask values and also allows you to create a LayerMask reference. I’m not sure if that’s very useful, but there might be a time when you want alot of GameObjects using the same changing LayerMask. After creating the class, I didn’t immediately need it because of how the editor exposes LayerMask, but in the case someone is having trouble with using LayerMask, I present you a solution.
https://github.com/LIB53/UnityScripts/blob/master/LayerMaskBuilder.cs
And in the case someone came in through a search engine:
If you don’t like what I made, there’s also another solution on the wiki that might help.