ARCameraBackgroundEditor.cs
1.61 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using UnityEngine;
using UnityEngine.XR.ARFoundation;
namespace UnityEditor.XR.ARFoundation
{
[CustomEditor(typeof(ARCameraBackground))]
internal class ARCameraBackgroundEditor : Editor
{
SerializedProperty m_UseCustomMaterial;
SerializedProperty m_CustomMaterial;
static class Tooltips
{
public static readonly GUIContent useCustomMaterial = new GUIContent(
"Use Custom Material",
"When false, a material is generated automatically from the shader included in the platform-specific package. When true, the Custom Material is used instead, overriding the automatically generated one. This is not necessary for most AR experiences.");
public static readonly GUIContent customMaterial = new GUIContent(
"Custom Material",
"The material to use for background rendering.");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(m_UseCustomMaterial, Tooltips.useCustomMaterial);
if (m_UseCustomMaterial.boolValue)
{
++EditorGUI.indentLevel;
EditorGUILayout.PropertyField(m_CustomMaterial, Tooltips.customMaterial);
--EditorGUI.indentLevel;
}
serializedObject.ApplyModifiedProperties();
}
void OnEnable()
{
m_UseCustomMaterial = serializedObject.FindProperty("m_UseCustomMaterial");
m_CustomMaterial = serializedObject.FindProperty("m_CustomMaterial");
}
}
}