Layermask changed

Hi, I want to using Raycast with LayerMask in the world. So, I Add Layer “Obstacle” to ‘User Layer 25’ and test in Unity. In Unity, It works. But, Test on ‘Build & Test’, It’s not working.

Debug.Log(string.Format("Test Object Layer Name : {0}", LayerMask.LayerToName(TestObject.layer)));

I used ‘Debug.Log()’ to check object layer that was “Obstacle”, and when I checked, Object layer was changed to “user3”.

What is problem? Is blank ‘User Layer’ can not using? Or am i mistaken about something?

LayerMask.LayerToName or NameToLayer do not work because worlds cannot upload their layer names with the bundle. You need to work with layers entirely by their number.

1 Like
_layerMask = 1 << 25;

Thank you for reply! I fixed LayerMask.NameToLayer to single number. It works. Thanks!