protected virtual void UpdateHandMesh()
        {
            using (UpdateHandMeshPerfMarker.Auto())
            {
                if (lastHandMeshInfo == null)
                {
                    return;
                }

                bool newMesh = handMeshFilter == null;

                IMixedRealityInputSystem        inputSystem         = CoreServices.InputSystem;
                MixedRealityHandTrackingProfile handTrackingProfile = inputSystem?.InputSystemProfile != null ? inputSystem.InputSystemProfile.HandTrackingProfile : null;
                if (newMesh && handTrackingProfile != null)
                {
                    // Create the hand mesh in the scene and assign the proper material to it
                    if (handTrackingProfile.SystemHandMeshMaterial.IsNotNull())
                    {
                        handMeshFilter = new GameObject("System Hand Mesh").EnsureComponent <MeshFilter>();
                        handMeshFilter.EnsureComponent <MeshRenderer>().material = handTrackingProfile.SystemHandMeshMaterial;
                    }
#pragma warning disable 0618
                    else if (handTrackingProfile.HandMeshPrefab.IsNotNull())
                    {
                        handMeshFilter = Instantiate(handTrackingProfile.HandMeshPrefab).GetComponent <MeshFilter>();
                    }
#pragma warning restore 0618

                    // Initialize the hand mesh if we generated it successfully
                    if (handMeshFilter != null)
                    {
                        lastHandMeshVerticesCount       = handMeshFilter.mesh.vertices.Length;
                        handMeshFilter.transform.parent = transform;
                    }
                }

                if (handMeshFilter != null)
                {
                    Mesh mesh = handMeshFilter.mesh;

                    bool meshChanged = false;
                    // On some platforms, mesh length counts may change as the hand mesh is updated.
                    // In order to update the vertices when the array sizes change, the mesh
                    // must be cleared per instructions here:
                    // https://docs.unity3d.com/ScriptReference/Mesh.html
                    if (lastHandMeshVerticesCount != lastHandMeshInfo.vertices?.Length)
                    {
                        meshChanged = true;
                        mesh.Clear();
                    }

                    mesh.vertices             = lastHandMeshInfo.vertices;
                    mesh.normals              = lastHandMeshInfo.normals;
                    lastHandMeshVerticesCount = lastHandMeshInfo.vertices != null ? lastHandMeshInfo.vertices.Length : 0;

                    if (newMesh || meshChanged)
                    {
                        mesh.triangles = lastHandMeshInfo.triangles;

                        if (lastHandMeshInfo.uvs?.Length > 0)
                        {
                            mesh.uv = lastHandMeshInfo.uvs;
                        }
                    }

                    if (meshChanged)
                    {
                        mesh.RecalculateBounds();
                    }

                    handMeshFilter.transform.SetPositionAndRotation(lastHandMeshInfo.position, lastHandMeshInfo.rotation);
                }
            }
        }