There may be a way.
var layerMaskList : LayerMask;
function Start ()
{
Debug.Log (layerMaskList.value);
}
Put this on an empty scene, set only one layer each time you launch the scene, in the layerMaskList, and observe the displayed value in the console.
It displays an int which is a sum.
A sum of what ?
In fact, each layer seems to have a value, which you add to the sum. If you have no layer, the sum is 0. If every layer is selected, you get -1 (probably a shortcut).
When you look carefully at the layer list, you have BuiltIn Layer 0, 1, 2, etc. If you set only Bulltin Layer 0 (Default), the sum is 1. If you set Bulltin Layer 1 (TransparentFX), the sum is 2.
If you have BuiltIn Layers 0, 1, 2 selected, the sum is 7.
What must we deduce ? For each BuiltIn Layer X, 2^X is added to the sum.
If you take the User Layer 8, you would get 256 (launching the scene with a custom layer at position 8 give us 256…).
The fact that the sum is only made of multiples of 2 (1, 2, 4, 8, 16…) ensures that each sum is made of a only precise layer mask list, because you could not reach this sum by an other list.
So, how is it related to triggers ? Well, when you trigger something, you can check for his gameObject.layer value and then check for whether it is included in the sum (if the sum is 254, you can’t possibly have the User Layer 8, which would have added 256 in the sum).
Do you understand ?