private static void ApplyTemplate(PWater water, PWaterProfile template)
        {
            water.Profile.CopyFrom(template);

            PWaterQuickSetupConfig config = PWaterQuickSetupConfig.Instance;

            water.MeshResolution = config.MeshResolution;
            water.MeshNoise      = config.MeshNoise;
            water.GeneratePlaneMesh();
            water.UpdateMaterial();
            water.TileSize = config.TileSize;
            MatchWaterLevel(water);
            MatchWaterSize(water);
        }
        private static void DrawWaterConfigGUI(PWater water)
        {
            DrawTemplateSelectionGUI(water);

            PWaterQuickSetupConfig config = PWaterQuickSetupConfig.Instance;
            bool changed     = false;
            bool meshChanged = false;

            EditorGUI.BeginChangeCheck();
            config.WaterLevel = EditorGUILayout.FloatField("Water Level", config.WaterLevel);
            if (EditorGUI.EndChangeCheck())
            {
                changed = true;
            }

            EditorGUI.BeginChangeCheck();
            config.MeshResolution = EditorGUILayout.DelayedIntField("Resolution", config.MeshResolution);
            if (EditorGUI.EndChangeCheck())
            {
                meshChanged = true;
            }

            EditorGUI.BeginChangeCheck();
            config.MeshNoise        = EditorGUILayout.FloatField("Noise", config.MeshNoise);
            config.ApproximateSizeX = EditorGUILayout.FloatField("Approx. Size X", config.ApproximateSizeX);
            config.ApproximateSizeZ = EditorGUILayout.FloatField("Approx. Size Z", config.ApproximateSizeZ);
            config.TileSize         = PEditorCommon.InlineVector2Field("Tile Size", config.TileSize);
            if (EditorGUI.EndChangeCheck())
            {
                changed = true;
            }

            if (meshChanged)
            {
                water.GeneratePlaneMesh();
            }

            if (changed || meshChanged)
            {
                water.MeshNoise = config.MeshNoise;
                water.TileSize  = config.TileSize;
                water.UpdateMaterial();
                MatchWaterLevel(water);
                MatchWaterSize(water);
            }

            EditorUtility.SetDirty(config);

            GEditorCommon.Separator();
            if (GUILayout.Button("Center To Level Bounds"))
            {
                CenterToLevel(water);
            }
            if (GUILayout.Button("Fill Level Bounds"))
            {
                Bounds levelBounds = GCommon.GetLevelBounds();
                config.ApproximateSizeX = levelBounds.size.x;
                config.ApproximateSizeZ = levelBounds.size.z;
                CenterToLevel(water);
                MatchWaterSize(water);
            }
            if (GUILayout.Button("Done"))
            {
                Done(water);
            }
        }