This is probably because of the way the CapsuleHand objects recreate its transforms every time the hand is put into view. Fixing it properly would require setting the layers when it does this. In the meantime, a workaround is to use a HandTransitionBehavior that does it instead. Add the following script to the CapsuleHand object:
using UnityEngine;
using System.Collections;
using Leap.Unity;
public class LayerSetter : HandTransitionBehavior {
public string layerName;
protected override void HandReset() {
int layer = LayerMask.NameToLayer(layerName);
gameObject.layer = layer;
Transform[] allChildren = GetComponentsInChildren<Transform>();
foreach (Transform child in allChildren) {
child.gameObject.layer = layer;
}
}
protected override void HandFinish() {}
}