Checking layers don't work

I have a special platform, that has a unique functionality and I want the player to know that it is special. So i do:

    public LayerMask Special;

if (bottomRay[0].collider.gameObject.layer == Special)

In the editor, I have set the platform’s layer to ‘special’ layer, and I have set the ‘special’ layer mask to the ‘special’ layer, and it does not work with tags, it does, but with layers it does not, the if statement does not result as true.

I try to see in debug.log
the platform’s tag is “14” which is the index of the layer.
the ‘special’ layermask variable is unityEngine.layerMask.
And they are not equal to each other, so the player can’t detect that it is a ‘special’ platform

Layer != LayerMask

Layer is an integer from 0 to 31.

LayerMask is a bitmask (00101010001) that describes which layers are turned on.

See: Unity - Manual: Introduction to layerMasks
See: Unity - Scripting API: LayerMask
See: Unity - Manual: Set a layerMask

For your problem, just check if

public int Special = 14

if (bottomRay[0].collider.gameObject.layer == Special)

LayerMasks, in contrast, are useful for things like Raycasts, where you may want to hit objects in several layers and ignore the other ones.

From your language, I’m not quite sure if you’re also using Tags, which are strings. It’s probably a good idea to not use integers for Tags since you’ll confuse them with layers.