private void Target()
    {
        Bounds         bounds               = MeshComponent.GetComponent <Renderer>().bounds;
        List <Vector3> cornerPoints         = GetAllCornerPoints(bounds);
        Rect           boundingViewportRect = GetBoundingViewportRect(cornerPoints, cam);

        CenterCameraOnViewportRect(cam, boundingViewportRect, paddingPercentage);
        SetDistanceFromPoint(cam, bounds.center, distance);
    }
        public override void OnInspectorGUI()
        {
            if (HasErrors())
            {
                return;
            }

            BeginEditing();

            OnPreInspectorGUI();

            EditorGUI.BeginDisabledGroup(_useLegacyMeshProperty.boolValue);
            var mf = MeshComponent.GetComponent <MeshFilter>();

            if (mf)
            {
                EditorGUI.BeginChangeCheck();
                var newMesh = (Mesh)EditorGUILayout.ObjectField("Mesh", mf.sharedMesh, typeof(Mesh), true);
                if (EditorGUI.EndChangeCheck())
                {
                    mf.sharedMesh = newMesh;
                }
            }
            EditorGUI.EndDisabledGroup();

            PropertyField(_useLegacyMeshProperty, rebuildMesh: true, onChanging: () => {
                if (mf)
                {
                    mf.sharedMesh = _useLegacyMeshProperty.boolValue
                                                ? new Mesh {
                        name = $"{target.name} (Generated)"
                    }                                   // when switching to legacy mesh, instantiate new mesh
                                                : null; // when switching to referenced mesh, reset reference.
                    EndEditing();
                }
            });
            EditorGUI.BeginDisabledGroup(!_useLegacyMeshProperty.boolValue);
            PropertyField(_sidesProperty, rebuildMesh: true);
            EditorGUI.EndDisabledGroup();

            base.OnInspectorGUI();

            EndEditing();
        }