您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
1.3 KiB
33 行
1.3 KiB
using UnityEngine;
|
|
using UnityEditor;
|
|
using UnityEngine.Experimental.Rendering.HDPipeline;
|
|
|
|
namespace Fontainebleau
|
|
{
|
|
[CustomEditorForRenderPipeline(typeof(WindZone), typeof(HDRenderPipelineAsset))]
|
|
sealed partial class BasicWindZoneEditor : Editor
|
|
{
|
|
SerializedProperty windMain;
|
|
SerializedProperty windTurbulence;
|
|
|
|
void OnEnable()
|
|
{
|
|
windMain = serializedObject.FindProperty("m_WindMain");
|
|
windTurbulence = serializedObject.FindProperty("m_WindTurbulence");
|
|
WindZone windZone = target as WindZone;
|
|
if (!windZone.GetComponent<BasicWindData>())
|
|
windZone.gameObject.AddComponent<BasicWindData>();
|
|
if (GameObject.FindObjectsOfType<BasicWindData>().Length > 1)
|
|
Debug.LogWarning("Your setup has more than one WindZone. Only one is supported by Basic Wind.");
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
serializedObject.Update();
|
|
EditorGUILayout.HelpBox("Only one directional wind zone is supported by Basic Wind.", MessageType.Info);
|
|
EditorGUILayout.PropertyField(windMain);
|
|
EditorGUILayout.Slider(windTurbulence, 0, 1);
|
|
serializedObject.ApplyModifiedProperties();
|
|
}
|
|
}
|
|
}
|