public static void SetInfluenceAdvancedControlSwitch(SerializedInfluenceVolume serialized, Editor owner, bool advancedControl)
        {
            if (advancedControl == serialized.editorAdvancedModeEnabled.boolValue)
            {
                return;
            }

            serialized.editorAdvancedModeEnabled.boolValue = advancedControl;
            if (advancedControl)
            {
                serialized.boxBlendDistancePositive.vector3Value       = serialized.editorAdvancedModeBlendDistancePositive.vector3Value;
                serialized.boxBlendDistanceNegative.vector3Value       = serialized.editorAdvancedModeBlendDistanceNegative.vector3Value;
                serialized.boxBlendNormalDistancePositive.vector3Value = serialized.editorAdvancedModeBlendNormalDistancePositive.vector3Value;
                serialized.boxBlendNormalDistanceNegative.vector3Value = serialized.editorAdvancedModeBlendNormalDistanceNegative.vector3Value;
                serialized.boxSideFadePositive.vector3Value            = serialized.editorAdvancedModeFaceFadePositive.vector3Value;
                serialized.boxSideFadeNegative.vector3Value            = serialized.editorAdvancedModeFaceFadeNegative.vector3Value;
            }
            else
            {
                serialized.boxBlendDistanceNegative.vector3Value       = serialized.boxBlendDistancePositive.vector3Value = Vector3.one * serialized.editorSimplifiedModeBlendDistance.floatValue;
                serialized.boxBlendNormalDistanceNegative.vector3Value = serialized.boxBlendNormalDistancePositive.vector3Value = Vector3.one * serialized.editorSimplifiedModeBlendNormalDistance.floatValue;
                serialized.boxSideFadeNegative.vector3Value            = serialized.boxSideFadePositive.vector3Value = Vector3.one;
            }
            serialized.Apply();
        }
        public static void DrawHandles_EditInfluenceNormal(SerializedInfluenceVolume serialized, Editor owner, Transform transform)
        {
            // Synchronize base handles
            s_BoxBaseHandle.center    = Vector3.zero;
            s_BoxBaseHandle.size      = serialized.boxSize.vector3Value;
            s_SphereBaseHandle.center = Vector3.zero;
            s_SphereBaseHandle.radius = serialized.sphereRadius.floatValue;

            switch ((InfluenceShape)serialized.shape.intValue)
            {
            case InfluenceShape.Box:
                EditorGUI.BeginChangeCheck();
                DrawBoxFadeHandle(serialized, owner, transform, s_BoxInfluenceNormalHandle, serialized.boxBlendNormalDistancePositive, serialized.boxBlendNormalDistanceNegative);
                if (EditorGUI.EndChangeCheck())
                {
                    //save advanced/simplified saved data
                    if (serialized.editorAdvancedModeEnabled.boolValue)
                    {
                        serialized.editorAdvancedModeBlendNormalDistancePositive.vector3Value = serialized.boxBlendNormalDistancePositive.vector3Value;
                        serialized.editorAdvancedModeBlendNormalDistanceNegative.vector3Value = serialized.boxBlendNormalDistanceNegative.vector3Value;
                    }
                    else
                    {
                        serialized.editorSimplifiedModeBlendNormalDistance.floatValue = serialized.boxBlendNormalDistancePositive.vector3Value.x;
                    }
                    serialized.Apply();
                }
                break;

            case InfluenceShape.Sphere:
                DrawSphereFadeHandle(serialized, owner, transform, s_SphereInfluenceNormalHandle, serialized.sphereBlendNormalDistance);
                break;
            }
        }
        static void Drawer_InfluenceAdvancedSwitch(SerializedInfluenceVolume serialized, Editor owner)
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();

                if (serialized.shape.intValue == (int)InfluenceShape.Sphere)
                {
                    GUI.enabled = false;
                }

                bool advanced = serialized.editorAdvancedModeEnabled.boolValue;
                advanced = !GUILayout.Toggle(!advanced, normalModeContent, EditorStyles.miniButtonLeft, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
                advanced = GUILayout.Toggle(advanced, advancedModeContent, EditorStyles.miniButtonRight, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
                s_BoxBaseHandle.monoHandle            = false;
                s_BoxInfluenceHandle.monoHandle       = !advanced;
                s_BoxInfluenceNormalHandle.monoHandle = !advanced;
                if (serialized.editorAdvancedModeEnabled.boolValue ^ advanced)
                {
                    serialized.editorAdvancedModeEnabled.boolValue = advanced;
                    if (advanced)
                    {
                        serialized.boxBlendDistancePositive.vector3Value       = serialized.editorAdvancedModeBlendDistancePositive.vector3Value;
                        serialized.boxBlendDistanceNegative.vector3Value       = serialized.editorAdvancedModeBlendDistanceNegative.vector3Value;
                        serialized.boxBlendNormalDistancePositive.vector3Value = serialized.editorAdvancedModeBlendNormalDistancePositive.vector3Value;
                        serialized.boxBlendNormalDistanceNegative.vector3Value = serialized.editorAdvancedModeBlendNormalDistanceNegative.vector3Value;
                        serialized.boxSideFadePositive.vector3Value            = serialized.editorAdvancedModeFaceFadePositive.vector3Value;
                        serialized.boxSideFadeNegative.vector3Value            = serialized.editorAdvancedModeFaceFadeNegative.vector3Value;
                    }
                    else
                    {
                        serialized.boxBlendDistanceNegative.vector3Value       = serialized.boxBlendDistancePositive.vector3Value = Vector3.one * serialized.editorSimplifiedModeBlendDistance.floatValue;
                        serialized.boxBlendNormalDistanceNegative.vector3Value = serialized.boxBlendNormalDistancePositive.vector3Value = Vector3.one * serialized.editorSimplifiedModeBlendNormalDistance.floatValue;
                        serialized.boxSideFadeNegative.vector3Value            = serialized.boxSideFadePositive.vector3Value = Vector3.one;
                    }
                    serialized.Apply();
                }

                if (serialized.shape.intValue == (int)InfluenceShape.Sphere)
                {
                    GUI.enabled = true;
                }
            }
        }
        static void Drawer_AdvancedBlendDistance(SerializedInfluenceVolume serialized, bool isNormal, Vector3 maxBlendDistance, GUIContent content)
        {
            SerializedProperty blendDistancePositive = isNormal ? serialized.boxBlendNormalDistancePositive : serialized.boxBlendDistancePositive;
            SerializedProperty blendDistanceNegative = isNormal ? serialized.boxBlendNormalDistanceNegative : serialized.boxBlendDistanceNegative;
            SerializedProperty editorAdvancedModeBlendDistancePositive = isNormal ? serialized.editorAdvancedModeBlendNormalDistancePositive : serialized.editorAdvancedModeBlendDistancePositive;
            SerializedProperty editorAdvancedModeBlendDistanceNegative = isNormal ? serialized.editorAdvancedModeBlendNormalDistanceNegative : serialized.editorAdvancedModeBlendDistanceNegative;
            SerializedProperty editorSimplifiedModeBlendDistance       = isNormal ? serialized.editorSimplifiedModeBlendNormalDistance : serialized.editorSimplifiedModeBlendDistance;
            Vector3            bdp = blendDistancePositive.vector3Value;
            Vector3            bdn = blendDistanceNegative.vector3Value;

            //resync to be sure prefab revert will keep syncs
            if (serialized.editorAdvancedModeEnabled.boolValue)
            {
                if (!(Mathf.Approximately(Vector3.SqrMagnitude(blendDistancePositive.vector3Value - editorAdvancedModeBlendDistancePositive.vector3Value), 0f) &&
                      Mathf.Approximately(Vector3.SqrMagnitude(blendDistanceNegative.vector3Value - editorAdvancedModeBlendDistanceNegative.vector3Value), 0f)))
                {
                    blendDistancePositive.vector3Value = editorAdvancedModeBlendDistancePositive.vector3Value;
                    blendDistanceNegative.vector3Value = editorAdvancedModeBlendDistanceNegative.vector3Value;
                    serialized.Apply();
                    SceneView.RepaintAll(); //update gizmo
                }
            }
            else
            {
                float scalar = editorSimplifiedModeBlendDistance.floatValue;
                if (!(Mathf.Approximately(blendDistancePositive.vector3Value.x, scalar) &&
                      Mathf.Approximately(blendDistancePositive.vector3Value.y, scalar) &&
                      Mathf.Approximately(blendDistancePositive.vector3Value.z, scalar) &&
                      Mathf.Approximately(blendDistanceNegative.vector3Value.x, scalar) &&
                      Mathf.Approximately(blendDistanceNegative.vector3Value.y, scalar) &&
                      Mathf.Approximately(blendDistanceNegative.vector3Value.z, scalar)))
                {
                    blendDistancePositive.vector3Value = blendDistanceNegative.vector3Value = new Vector3(scalar, scalar, scalar);
                    serialized.Apply();
                    SceneView.RepaintAll(); //update gizmo
                }
            }

            if (serialized.editorAdvancedModeEnabled.boolValue)
            {
                EditorGUI.BeginChangeCheck();
                CoreEditorUtils.DrawVector6(content, editorAdvancedModeBlendDistancePositive, editorAdvancedModeBlendDistanceNegative, Vector3.zero, maxBlendDistance, k_HandlesColor);
                if (EditorGUI.EndChangeCheck())
                {
                    blendDistancePositive.vector3Value = editorAdvancedModeBlendDistancePositive.vector3Value;
                    blendDistanceNegative.vector3Value = editorAdvancedModeBlendDistanceNegative.vector3Value;
                }
            }
            else
            {
                Rect lineRect = EditorGUILayout.GetControlRect();
                EditorGUI.BeginProperty(lineRect, content, editorSimplifiedModeBlendDistance);
                float distance = editorSimplifiedModeBlendDistance.floatValue;
                EditorGUI.BeginChangeCheck();
                distance = EditorGUI.FloatField(lineRect, content, distance);
                if (EditorGUI.EndChangeCheck())
                {
                    distance = Mathf.Clamp(distance, 0f, Mathf.Max(maxBlendDistance.x, maxBlendDistance.y, maxBlendDistance.z));
                    Vector3 decal = Vector3.one * distance;
                    bdp.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
                    bdp.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
                    bdp.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
                    bdn.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
                    bdn.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
                    bdn.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
                    blendDistancePositive.vector3Value           = bdp;
                    blendDistanceNegative.vector3Value           = bdn;
                    editorSimplifiedModeBlendDistance.floatValue = distance;
                }
                EditorGUI.EndProperty();
            }
        }