Typo: Reference Manual > Scripting Concepts > Layers p

I think there’s a typo on the Reference page for Layers.
(Unity - Manual: Layers)

// bit shift the index of the layer to get a bit mask
var layerMask = 1 << 8;
// Does the ray intersect any objects which are in the player layer.
if (Physics.Raycast (transform.position, Vector3.forward, Mathf.Infinity, layer))
    print ("The ray hit the player");

It should be:

// bit shift the index of the layer to get a bit mask
var layerMask = 1 << 8;
// Does the ray intersect any objects which are in the player layer.
if (Physics.Raycast (transform.position, Vector3.forward, Mathf.Infinity, layerMask))
    print ("The ray hit the player");

The variable name should be “layerMask” instead of “layer”.

:slight_smile:

to report bugs you should use the Bug Reporter (standalone application, even though it might appear differently as it comes up automatically on crash). There is an explicit type for doc errors :slight_smile:

Good point. Just submitted it with the Report Bug application.
(To Admin: please feel free to delete this thread.)