using UnityEngine; using UnityEditor; [CustomEditor(typeof(CompiledShaderBehaviour))] public class CompiledShaderBehaviourEditor : Editor { SerializedProperty shaderProperty; public void OnEnable () { shaderProperty = serializedObject.FindProperty ("shader"); } public override void OnInspectorGUI () { serializedObject.Update (); EditorGUILayout.PropertyField (shaderProperty); Shader shader = shaderProperty.objectReferenceValue as Shader; if (shader) { string compiledShaderString = (new SerializedObject(shader)).FindProperty("m_Script").stringValue; EditorGUILayout.TextArea (compiledShaderString); } serializedObject.ApplyModifiedProperties (); } }