Files
SimUL/Packages/com.verasl.water-system/Editor/WaterSettingsDataEditor.cs
T
2023-12-06 20:29:45 +02:00

48 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
namespace WaterSystem.Data
{
[CustomEditor(typeof(WaterSettingsData))]
public class WaterSettingsDataEditor : Editor
{
public override void OnInspectorGUI()
{
var geomType = serializedObject.FindProperty("waterGeomType");
EditorGUILayout.PropertyField(geomType);
var refType = serializedObject.FindProperty("refType");
refType.enumValueIndex = GUILayout.Toolbar(refType.enumValueIndex, refType.enumDisplayNames);
switch(refType.enumValueIndex)
{
case 0:
{
// cubemap
var cube = serializedObject.FindProperty("cubemapRefType");
EditorGUILayout.PropertyField(cube, new GUIContent("Cubemap Texture"));
}
break;
case 1:
{
// probe
EditorGUILayout.HelpBox("Reflection Probe setting has no options, it automatically uses the nearest reflection probe to the main camera", MessageType.Info);
}
break;
case 2:
{
// planar
var planarSettings = serializedObject.FindProperty("planarSettings");
EditorGUILayout.PropertyField(planarSettings, true);
}
break;
}
serializedObject.ApplyModifiedProperties();
}
}
}