Skip to content

Instantly share code, notes, and snippets.

@quizcanners
Last active March 28, 2019 07:26
Show Gist options
  • Save quizcanners/f93dca1829348094212e6e30bd85f1fc to your computer and use it in GitHub Desktop.
Save quizcanners/f93dca1829348094212e6e30bd85f1fc to your computer and use it in GitHub Desktop.
public override void OnInspectorGUI() {
var controller = (MyMaterialController )target;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
controller .transparency = EditorGUILayout.FloatField("Object's Transparency:", controller .transparency);
if (EditorGUI.EndChangeCheck())
controller .RecalculateShaderParameters();
GUIContent cont = new GUIContent {
tooltip = "Will load default value",
image = refreshIcon
};
if (controller .transparency != 0.5 && GUILayout.Button(cont, GUILayout.MaxWidth(25), GUILayout.MaxHeight(25)))
controller .transparency = 0.5;
EditorGUILayout.EndHorizontal();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment