您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
42 行
1.3 KiB
42 行
1.3 KiB
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
namespace UnityEditor.Rendering.Universal
|
|
{
|
|
[CustomEditor(typeof(PostProcessData), true)]
|
|
public class PostProcessDataEditor : Editor
|
|
{
|
|
SerializedProperty m_Shaders;
|
|
SerializedProperty m_Textures;
|
|
|
|
private void OnEnable()
|
|
{
|
|
m_Shaders = serializedObject.FindProperty("shaders");
|
|
m_Textures = serializedObject.FindProperty("textures");
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
serializedObject.Update();
|
|
|
|
// Add a "Reload All" button in inspector when we are in developer's mode
|
|
if (EditorPrefs.GetBool("DeveloperMode"))
|
|
{
|
|
EditorGUILayout.Space();
|
|
EditorGUILayout.PropertyField(m_Shaders, true);
|
|
EditorGUILayout.PropertyField(m_Textures, true);
|
|
|
|
if (GUILayout.Button("Reload All"))
|
|
{
|
|
var resources = target as PostProcessData;
|
|
resources.shaders = null;
|
|
resources.textures = null;
|
|
ResourceReloader.ReloadAllNullIn(target, UniversalRenderPipelineAsset.packagePath);
|
|
}
|
|
}
|
|
|
|
serializedObject.ApplyModifiedProperties();
|
|
}
|
|
}
|
|
}
|