diff --git a/TwoForksVr/src/Helpers/LayerHelper.cs b/TwoForksVr/src/Helpers/LayerHelper.cs index a935f182..7e5712bd 100644 --- a/TwoForksVr/src/Helpers/LayerHelper.cs +++ b/TwoForksVr/src/Helpers/LayerHelper.cs @@ -52,5 +52,14 @@ public static void SetLayer(GameObject gameObject, GameLayer layer) { gameObject.layer = (int) layer; } + + public static void SetLayerRecursive(GameObject gameObject, GameLayer layer) + { + SetLayer(gameObject, layer); + foreach (Transform child in gameObject.transform) + { + SetLayerRecursive(child.gameObject, layer); + } + } } } \ No newline at end of file diff --git a/TwoForksVr/src/Limbs/VrHand.cs b/TwoForksVr/src/Limbs/VrHand.cs index 0d8303af..91a40272 100644 --- a/TwoForksVr/src/Limbs/VrHand.cs +++ b/TwoForksVr/src/Limbs/VrHand.cs @@ -15,6 +15,7 @@ public static VrHand Create(Transform parent, bool isLeft = false) { var handName = isLeft ? "Left" : "Right"; var transform = Instantiate(isLeft ? VrAssetLoader.LeftHandPrefab : VrAssetLoader.RightHandPrefab, parent, false).transform; + LayerHelper.SetLayerRecursive(transform.gameObject, GameLayer.UI); transform.name = $"{handName}Hand"; var instance = transform.gameObject.AddComponent(); instance.handName = handName;