Ejemplo n.º 1
0
 private static void OpenInCodeEditor()
 {
     if (Selection.activeObject.GetType() == typeof(TextAsset))
     {
         TextAsset asset = Selection.activeObject as TextAsset;
         CodeWindow.CreateWindow(Application.dataPath + AssetDatabase.GetAssetPath(asset).Substring(6));
     }
     if (Selection.activeObject.GetType() == typeof(MonoScript))
     {
         MonoScript asset = Selection.activeObject as MonoScript;
         CodeWindow.CreateWindow(Application.dataPath + AssetDatabase.GetAssetPath(asset).Substring(6));
     }
 }
Ejemplo n.º 2
0
 public override void OnInspectorGUI()
 {
     try
     {
         EditorGUI.EndDisabledGroup();
         GUILayout.BeginHorizontal();
         if (GUILayout.Button("Open in Code Editor", GUILayout.Height(30)))
         {
             TextAsset script = (TextAsset)target;
             CodeWindow.CreateWindow(Application.dataPath + AssetDatabase.GetAssetPath(script).Substring(6));
         }
         GUILayout.EndHorizontal();
         EditorGUI.BeginDisabledGroup(true);
     } catch
     {
         base.OnInspectorGUI();
     }
 }
Ejemplo n.º 3
0
 public override void OnInspectorGUI()
 {
     try {
         base.OnInspectorGUI();
         GUILayout.Space(10);
         GUILayout.BeginHorizontal();
         if (GUILayout.Button("Open in Code Editor", GUILayout.Height(30)))
         {
             MonoScript script = (MonoScript)target;
             CodeWindow.CreateWindow(Application.dataPath + AssetDatabase.GetAssetPath(script).Substring(6));
         }
         GUILayout.EndHorizontal();
     }
     catch
     {
         base.OnInspectorGUI();
     }
 }
Ejemplo n.º 4
0
 public override void OnInspectorGUI()
 {
     try {
         base.OnInspectorGUI();
         GUILayout.BeginHorizontal();
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("Open in Code Editor"))
         {
             MonoBehaviour myTarget = (MonoBehaviour)target;
             MonoScript    script   = MonoScript.FromMonoBehaviour(myTarget);
             CodeWindow.CreateWindow(Application.dataPath + AssetDatabase.GetAssetPath(script).Substring(6));
         }
         GUILayout.EndHorizontal();
     } catch
     {
         base.OnInspectorGUI();
     }
 }