Last active
December 20, 2015 01:19
-
-
Save CapnRat/6048145 to your computer and use it in GitHub Desktop.
Revisions
-
CapnRat revised this gist
Jul 21, 2013 . 3 changed files with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ using UnityEngine; public class CompiledShaderBehaviour : MonoBehaviour { public Shader shader; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ using UnityEngine; using UnityEditor; [CustomEditor(typeof(CompiledShaderBehaviour))] public class CompiledShaderBehaviourEditor : Editor { SerializedProperty shaderProperty; public void OnEnable () { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +0,0 @@ -
CapnRat created this gist
Jul 21, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ using UnityEngine; public class NewBehaviourScript : MonoBehaviour { public Shader shader; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ using UnityEngine; using UnityEditor; [CustomEditor(typeof(NewBehaviourScript))] public class NewBehaviourScriptEditor : 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 (); } }