Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
RgbmCubedSkyboxInspector.cs
Go to the documentation of this file.
1 using UnityEngine;
2 #if UNITY_EDITOR
3 using UnityEditor;
4 
5 namespace droid.Runtime.Shaders.Experimental.Skybox_Shaders.Editor {
6  public class RgbmCubedSkyboxInspector : MaterialEditor {
7  public override void OnInspectorGUI() {
8  base.OnInspectorGUI();
9 
10  if (this.isVisible) {
11  var material = this.target as Material;
12 
13  var use_linear = false;
14  foreach (var keyword in material.shaderKeywords) {
15  if (keyword == "USE_LINEAR") {
16  use_linear = true;
17  break;
18  }
19  }
20 
21  EditorGUI.BeginChangeCheck();
22 
23  use_linear = EditorGUILayout.Toggle("Linear Space Lighting", use_linear);
24 
25  if (EditorGUI.EndChangeCheck()) {
26  if (use_linear) {
27  material.EnableKeyword("USE_LINEAR");
28  material.DisableKeyword("USE_GAMMA");
29  } else {
30  material.DisableKeyword("USE_LINEAR");
31  material.EnableKeyword("USE_GAMMA");
32  }
33 
34  EditorUtility.SetDirty(this.target);
35  }
36  }
37  }
38  }
39 }
40 #endif