-
Notifications
You must be signed in to change notification settings - Fork 867
Expand file tree
/
Copy pathLightProbeProxyVolumeEditor.cs
More file actions
31 lines (28 loc) · 1.08 KB
/
LightProbeProxyVolumeEditor.cs
File metadata and controls
31 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Rendering;
namespace UnityEditor
{
#pragma warning disable CS0618 // Type or member is obsolete
[CustomEditor(typeof(LightProbeProxyVolume))]
[CanEditMultipleObjects]
class LightProbeProxyVolumeEditor : Editor
{
public override void OnInspectorGUI()
{
if (GraphicsSettings.isScriptableRenderPipelineEnabled)
{
const int offsetToMatchWarning = 16;
Rect buttonRect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight);
buttonRect.x -= offsetToMatchWarning;
buttonRect.width += offsetToMatchWarning;
if (GUI.Button(buttonRect, "Add Adaptive Probe Volume component") && serializedObject.targetObject is LightProbeProxyVolume proxy)
{
proxy.gameObject.AddComponent<ProbeVolume>();
EditorSceneManager.MarkSceneDirty(proxy.gameObject.scene);
}
}
DrawDefaultInspector();
}
}
}