Skip to content

Commit c2238a1

Browse files
authored
Merge pull request #6238 from davidkline-ms/inv6234_take2
Fix 6234 (no input after toggling hand mesh)
2 parents 4dc2300 + b90f0fe commit c2238a1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Assets/MixedRealityToolkit/Providers/Hands/BaseHandVisualizer.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,16 @@ public void OnHandMeshUpdated(InputEventData<HandMeshInfo> eventData)
182182
{
183183
Mesh mesh = handMeshFilter.mesh;
184184

185+
bool meshChanged = false;
185186
// On some platforms, mesh length counts may change as the hand mesh is updated.
186187
// In order to update the vertices when the array sizes change, the mesh
187188
// must be cleared per instructions here:
188189
// https://docs.unity3d.com/ScriptReference/Mesh.html
189-
if (lastHandMeshVertices.Length != 0 &&
190+
if (lastHandMeshVertices != null &&
191+
lastHandMeshVertices.Length != 0 &&
190192
lastHandMeshVertices.Length != eventData.InputData.vertices?.Length)
191193
{
194+
meshChanged = true;
192195
mesh.Clear();
193196
}
194197

@@ -202,7 +205,10 @@ public void OnHandMeshUpdated(InputEventData<HandMeshInfo> eventData)
202205
mesh.uv = eventData.InputData.uvs;
203206
}
204207

205-
mesh.RecalculateBounds();
208+
if (meshChanged)
209+
{
210+
mesh.RecalculateBounds();
211+
}
206212

207213
handMeshFilter.transform.position = eventData.InputData.position;
208214
handMeshFilter.transform.rotation = eventData.InputData.rotation;

0 commit comments

Comments
 (0)