Skip to content

Commit bd029a2

Browse files
committed
Update PlatformHandMeshVisualizer.cs
1 parent 1f09e51 commit bd029a2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

org.mixedrealitytoolkit.input/Visualizers/PlatformHandVisualizer/PlatformHandMeshVisualizer.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ protected override void OnEnable()
4242
{
4343
base.OnEnable();
4444

45+
handRenderer.enabled = false;
46+
4547
if (neutralPoseMesh == null)
4648
{
4749
neutralPoseMesh = new Mesh();
@@ -59,6 +61,15 @@ protected override void OnEnable()
5961
#endif
6062
}
6163

64+
/// <summary>
65+
/// A Unity event function that is called when the script component has been disabled.
66+
/// </summary>
67+
protected void OnDisable()
68+
{
69+
// Disable the rigged hand renderer when this component is disabled
70+
handRenderer.enabled = false;
71+
}
72+
6273
protected void Update()
6374
{
6475
#if MROPENXR_PRESENT && (UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_ANDROID)
@@ -104,13 +115,17 @@ private void UpdateHandMaterial()
104115
handRenderer.SetPropertyBlock(propertyBlock);
105116
}
106117

107-
#if MROPENXR_PRESENT && (UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_ANDROID)
108118
protected override bool ShouldRenderHand()
109119
{
110120
// If we're missing anything, don't render the hand.
111-
return handMeshTracker != null && meshFilter != null && handRenderer != null && base.ShouldRenderHand();
121+
return
122+
#if MROPENXR_PRESENT && (UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_ANDROID)
123+
handMeshTracker != null &&
124+
#endif
125+
meshFilter != null && handRenderer != null && base.ShouldRenderHand();
112126
}
113127

128+
#if MROPENXR_PRESENT && (UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_ANDROID)
114129
private Vector2[] InitializeUVs(Vector3[] neutralPoseVertices)
115130
{
116131
if (neutralPoseVertices?.Length == 0)

0 commit comments

Comments
 (0)