private void DrawUpdateControllerButton() { if (GUILayout.Button("Update Controller")) { string scriptPath = UnityEditor.AssetDatabase.GetAssetPath(UnityEditor.MonoScript.FromMonoBehaviour(shaderController)); Shader shader = shaderProperty.objectReferenceValue as Shader; if (isPostProcessControllerProperty.boolValue) { ShaderControllerGeneratorInterface.GeneratePostProcessController(shader, scriptPath); } else { ShaderControllerGeneratorInterface.GenerateShaderController(shader, scriptPath); } Debug.Log($"[Shader Controller] {Path.GetFileName(scriptPath)} updated"); } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.Space(); if (GUILayout.Button("Update Controller")) { string scriptPath = UnityEditor.AssetDatabase.GetAssetPath(UnityEditor.MonoScript.FromMonoBehaviour(postProcessController)); ShaderControllerGeneratorInterface.GeneratePostProcessController(shader, scriptPath); Debug.Log($"[Shader Controller] {Path.GetFileName(scriptPath)} updated"); } EditorGUILayout.Space(); GUI.enabled = false; EditorGUILayout.PropertyField(shaderProperty); GUI.enabled = true; DrawDefaultInspector(); }