您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
1.1 KiB
38 行
1.1 KiB
using Unity.Mathematics;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace WaterSystem
|
|
{
|
|
[CustomEditor(typeof(BuoyantObject))]
|
|
public class BuoyantObjectEditor : Editor
|
|
{
|
|
private BuoyantObject obj;
|
|
|
|
private void OnEnable()
|
|
{
|
|
obj = serializedObject.targetObject as BuoyantObject;
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
base.OnInspectorGUI();
|
|
|
|
EditorGUILayout.BeginFoldoutHeaderGroup(true, "Debug Info");
|
|
|
|
EditorGUILayout.LabelField("Height Values", EditorStyles.boldLabel);
|
|
if (obj.Heights != null)
|
|
{
|
|
for (int i = 0; i < obj.Heights.Length; i++)
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
float3 h = obj.Heights[i];
|
|
EditorGUILayout.LabelField($"{i})Wave(heights):", $"X:{h.x:00.00} Y:{h.y:00.00} Z:{h.z:00.00}");
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
}
|
|
|
|
EditorGUILayout.EndFoldoutHeaderGroup();
|
|
}
|
|
}
|
|
}
|