Skip to content

Commit

Permalink
Fix hand visibility in menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Raicuparta committed Jan 19, 2022
1 parent 2cad498 commit 07bd406
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions TwoForksVr/src/Helpers/LayerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
1 change: 1 addition & 0 deletions TwoForksVr/src/Limbs/VrHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<VrHand>();
instance.handName = handName;
Expand Down

0 comments on commit 07bd406

Please sign in to comment.