25 lines
792 B
C#
25 lines
792 B
C#
using UnityEngine;
|
|
using UnityEditor;
|
|
public class PlayerTransparentShaderGui : FlowToggleShaderGui
|
|
{
|
|
public const string rimKeyword = "UseRimColor";
|
|
|
|
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
|
{
|
|
// render the default gui
|
|
base.OnGUI(materialEditor, properties);
|
|
var targetMat = (Material)materialEditor.target;
|
|
// see if redify is set, and show a checkbox
|
|
var useRim = System.Array.IndexOf(targetMat.shaderKeywords, rimKeyword) >= 0;
|
|
EditorGUI.BeginChangeCheck();
|
|
useRim = EditorGUILayout.Toggle("Use Outline", useRim);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
// enable or disable the keyword based on checkbox
|
|
if (useRim)
|
|
targetMat.EnableKeyword(rimKeyword);
|
|
else
|
|
targetMat.DisableKeyword(rimKeyword);
|
|
}
|
|
}
|
|
} |