您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

47 行
1.2 KiB

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();
}
}
}