title: Best way to set a GameObject layer programmatically?
body: <p>I know that you can set up a Layer Mask through code with the LayerMask.NameToLayer function, and that public layer masks can be set through a dropdown in the editor.LayerMask provides the value getter, but that actually returns the bitmask, not the integer of the layer. I could get the integer value, but unfortunately the only way to inverse a bitshift function is to use a logarithm, and those are pretty expensive....so if there are a lot of shots, that's something you don't want, right? How can I set LayerMask as game object Layer(GameObject obj; then obj.layer = ?). Please, Anyone help me.</p>