I need to gain access to the editor’s layer mask to switch between some layer patterns. The idea is to have few layers for the game and few for the gui. Switching between them manually is a waste of time (especially if there are number of layers). Moreover it would be great to be able to specify the layer mask for each scene view window. This would allow to have a game editing window and a gui editing window. Any idea?
I do not entirely understand your question, but the way that one sets layer mask variables via script is by using a bitwise operator: 1<<. For example, if I wanted to linecast to only the layer “Enemies,” I would say Physics.Linecast (Vector3.zero, Vector3.one, 1 << LayerMask.NameToLayer(“Enemies”)); What this code does is make the layer into a string of 1s and 0s, which in turn are used to check layers.
If anyone else finds this. You can do this by changing:
There is also one for locking layers: