Advertisement
GibTreaty

Unity3D - Script Viewer

Apr 27th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4.  
  5.  
  6. public class ScriptViewerWindow : EditorWindow {
  7.  
  8.     public TextAsset script;
  9.     public Vector2 scroll = Vector2.zero;
  10.  
  11.     [MenuItem("Window/Script Viewer")]
  12.     static void Init() {
  13.         CreateInstance<ScriptViewerWindow>().Show(true);
  14.     }
  15.  
  16.     void OnGUI() {
  17.         script = EditorGUILayout.ObjectField(script, typeof(TextAsset)) as TextAsset;
  18.  
  19.         if(script) {
  20.             scroll = EditorGUILayout.BeginScrollView(scroll);
  21.             GUILayout.TextArea(script.text);
  22.             EditorGUILayout.EndScrollView();
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement