Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Opensource Script Editor

Discussion in 'Works In Progress' started by slkjdfv, Jun 27, 2013.

  1. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    As soon as I can finish up some things I'll be releasing this new script editor I'm working on. Please see snapshot at the bottom for what I have so far...
    Features :
    • syntax highlighting
    • reads all script types - .shader, .cs, .js, .boo, .txt, .ini, etc...
    • saving, loading, and creating of new scripts
    • more to come :D

    The great thing about this new editor is you no longer have to leave unity to code any more :D

    $My Script editor.png

    Release notes
    • Version 1.0
      • Load, Create and Save features added
      • Color coding of text added
      • Basic syntax highlighting
    • Version 1.0.1
      • Menu bar added
      • Support for multiple files open at once added

    Bugs List
    • Comments and Strings syntax highlights will sometimes continue onto the next line
    • Comments containing '/* ... */' Don't highlight correctly at the end;
    • Text Editor Doesn't refresh when you open a file or switch between them. To refresh just click back inside the textfield.
    • Line numbering doesn't take into account wrapping text.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using UnityEditor;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6. using System.IO;
    7.  
    8. public class ScriptEditor : EditorWindow
    9. {
    10.     string s = "";
    11.     int lines = 0;
    12.     string path = Application.dataPath;
    13.     Vector2 scrollPos = new Vector2 ( );   
    14.  
    15.     GUIStyle textStyle = new GUIStyle();   
    16.     Vector2 tSize = new Vector2();
    17.  
    18.     bool isCommenting = false;
    19.     bool isString = false;
    20.     bool commentAffectsNextLine = false;
    21.  
    22.     List<string> redos = new List<string> ( );
    23.  
    24.     int toolbarMenuIndex = -1;
    25.     string[] fileOptions = new string [ ]
    26.             {
    27.                 "New",
    28.                 "Load",
    29.                 "Save",
    30.                                 "Save as",
    31.                 "Close Tab",
    32.                 "Close All Tabs"
    33.             };
    34.  
    35.     string[] editOptions = new string [ ]
    36.             {
    37.                 "Cut",
    38.                 "Copy",            
    39.                 "Paste"
    40.             };
    41.  
    42.     #region cSharp namespaces
    43.     public List<string> cNamespaces = new List<string> ( )
    44.     {
    45.         "abstract",
    46.         "as",
    47.         "base",
    48.         "break",       
    49.         "bool",
    50.         "by",
    51.         "byte",
    52.         "case",
    53.         "catch",
    54.         "char",
    55.         "checked",
    56.         "class",
    57.         "const",
    58.         "continue",
    59.         "decimal",
    60.         "default",
    61.         "delegate",
    62.         "do",
    63.         "double",
    64.         "else",
    65.         "enum",
    66.         "event",
    67.         "explicit",
    68.         "extern",
    69.         "false",   
    70.         "finally",
    71.         "fixed",
    72.         "float",
    73.         "for",
    74.         "foreach",
    75.         "from",
    76.         "group",
    77.         "if",
    78.         "implicit",
    79.         "in",      
    80.         "int",
    81.         "interface",
    82.         "internal",
    83.         "into",
    84.         "is",
    85.         "lock",
    86.         "long",
    87.         "namespace",
    88.         "new",
    89.         "null",
    90.         "object",
    91.         "operator",
    92.         "out",
    93.         "override",
    94.         "params",
    95.         "private",
    96.         "protected",
    97.         "public",
    98.         "readonly",
    99.         "ref",
    100.         "return",
    101.         "sbyte",
    102.         "sealed",
    103.         "select",
    104.         "sizeof",
    105.         "short",
    106.         "stackalloc",
    107.         "static",
    108.         "string",
    109.         "struct",
    110.         "switch",
    111.         "this",
    112.         "throw",
    113.         "true",
    114.         "try",
    115.         "typeof",
    116.         "unchecked",
    117.         "uint",
    118.         "ulong",
    119.         "unsafe",
    120.         "using",
    121.         "var",
    122.         "virtual",
    123.         "volatile",
    124.         "void",
    125.         "where",
    126.         "while",
    127.         "yield"
    128.     };
    129.     #endregion
    130.  
    131.     List<Tab> fileTabs = new List<Tab> ( );
    132.     int fileTabIndex = -1;
    133.     // Use this for initialization
    134.     [MenuItem ( "Window/Script Editor" )]
    135.     static void Init ( )
    136.     {
    137.         ScriptEditor window = ( ScriptEditor )EditorWindow.GetWindow ( typeof ( ScriptEditor ), false, "Script Editor" );
    138.         window.s= "";
    139.                 window.lines = 0;
    140.         window.textStyle = null;
    141.         window.minSize = new Vector2 ( 200, 100 );
    142.         window.cNamespaces = new List<string> ( )
    143.         {
    144.             "abstract",
    145.             "as",
    146.             "base",
    147.             "break",       
    148.             "bool",
    149.             "by",
    150.             "byte",
    151.             "case",
    152.             "catch",
    153.             "char",
    154.             "checked",
    155.             "class",
    156.             "const",
    157.             "continue",
    158.             "decimal",
    159.             "default",
    160.             "delegate",
    161.             "do",
    162.             "double",
    163.             "else",
    164.             "enum",
    165.             "event",
    166.             "explicit",
    167.             "extern",
    168.             "false",   
    169.             "finally",
    170.             "fixed",
    171.             "float",
    172.             "for",
    173.             "foreach",
    174.             "from",
    175.             "group",
    176.             "if",
    177.             "implicit",
    178.             "in",      
    179.             "int",
    180.             "interface",
    181.             "internal",
    182.             "into",
    183.             "is",
    184.             "lock",
    185.             "long",
    186.             "namespace",
    187.             "new",
    188.             "null",
    189.             "object",
    190.             "operator",
    191.             "out",
    192.             "override",
    193.             "params",
    194.             "private",
    195.             "protected",
    196.             "public",
    197.             "readonly",
    198.             "ref",
    199.             "return",
    200.             "sbyte",
    201.             "sealed",
    202.             "select",
    203.             "sizeof",
    204.             "short",
    205.             "stackalloc",
    206.             "static",
    207.             "string",
    208.             "struct",
    209.             "switch",
    210.             "this",
    211.             "throw",
    212.             "true",
    213.             "try",
    214.             "typeof",
    215.             "unchecked",
    216.             "uint",
    217.             "ulong",
    218.             "unsafe",
    219.             "using",
    220.             "var",
    221.             "virtual",
    222.             "volatile",
    223.             "void",
    224.             "where",
    225.             "while",
    226.             "yield"
    227.         };
    228.     }
    229.  
    230.     class Tab
    231.     {
    232.         public string fileName;
    233.         public string filePath;
    234.         public string fileText;
    235.  
    236.         public Tab (string name, string path, string text )
    237.         {
    238.             fileName = name;
    239.             filePath = path;
    240.             fileText = text;
    241.         }
    242.     }
    243.    
    244.     // Update is called once per frame
    245.     void OnGUI ()
    246.     {
    247.                 if(textStyle == null)
    248.             textStyle = new GUIStyle ( GUI.skin.textArea );
    249.         TextEditor te = ( TextEditor )GUIUtility.GetStateObject ( typeof ( TextEditor ), GUIUtility.keyboardControl );
    250.         //backup color
    251.         Color backupColor = Color.white;
    252.         Color backupContentColor = Color.black;
    253.         Color backupBackgroundColor = GUI.backgroundColor;
    254.  
    255.         GUI.Box ( new Rect ( 0, 0, position.width, 20 ), "", "toolbar" );
    256.  
    257.         toolbarMenuIndex = EditorGUI.Popup ( new Rect ( 0, 0, 40, 20 ), toolbarMenuIndex, fileOptions, "toolbarButton" );
    258.         GUI.Label ( new Rect ( 0, 0, 40, 20 ), "File" );
    259.         if ( GUI.changed )
    260.         {
    261.             CheckFileOptions (te );
    262.         }
    263.  
    264.         toolbarMenuIndex = EditorGUI.Popup ( new Rect ( 40, 0, 40, 20 ), toolbarMenuIndex, editOptions, "toolbarButton" );
    265.         GUI.Label ( new Rect ( 40, 0, 40, 20 ), "Edit" );
    266.         if ( GUI.changed )
    267.         {
    268.             CheckEditOptions ( te );
    269.         }
    270.         GUI.Box ( new Rect ( 0, 18, position.width, 20 ), "", "toolbar" );
    271.  
    272.         tSize.y =  textStyle.CalcHeight ( new GUIContent ( s ), position.width );
    273.         tSize.x = position.width;
    274.  
    275.         GUILayout.BeginArea (new Rect(0,18,position.width,20) );
    276.         GUILayout.BeginHorizontal ( );
    277.         if(fileTabs.Count > 0)
    278.         {
    279.             for(int i = 0; i < fileTabs.Count; i++)
    280.             {
    281.                 Tab tab = fileTabs[i];
    282.                 if ( GUILayout.Button ( tab.fileName, "toolbarButton" ) )
    283.                 {
    284.                     fileTabs[fileTabIndex].fileText = s;
    285.                     fileTabIndex = i;
    286.                     s = tab.fileText;
    287.                 }              
    288.             }          
    289.         }
    290.         GUILayout.EndHorizontal ( );
    291.         GUILayout.EndArea ( );
    292.         scrollPos = GUI.BeginScrollView ( new Rect(0,36,position.width, position.height-36), scrollPos, new Rect(0,0,tSize.x-15,tSize.y+20) );
    293.        
    294.         for ( int i = 0; i < lines; i++ )
    295.         {
    296.             Vector2 lSize = textStyle.CalcSize ( new GUIContent ( i.ToString ( ) ) );
    297.             if(i%2 == 1)
    298.             {
    299.                 GUI.color = Color.gray;
    300.                 GUI.Box (new Rect(-2, 13 * i+13, position.width+4 + tSize.x, 13 ), "");
    301.             }
    302.             GUI.color = Color.white;
    303.             GUI.Label ( new Rect ( 0, 13 * i+13, lSize.x + 50, 13 ), "" + i );
    304.         }
    305.  
    306.         Event ev = Event.current;
    307.  
    308.         //add textarea with transparent text
    309.         GUI.contentColor = new Color ( 1f, 1f, 1f, 0f );
    310.         Rect bounds = new Rect ( 60, 13, position.width-80, position.height+tSize.y);
    311.         GUI.SetNextControlName ( "TextArea" );
    312.  
    313.         s = GUI.TextArea ( bounds, s );
    314.         //get the texteditor of the textarea to control selection
    315.        
    316.  
    317.         CheckKeys ( te, ev );
    318.         //set background of all textfield transparent
    319.         GUI.backgroundColor = new Color ( 1f, 1f, 1f, 0f );
    320.  
    321.         //backup selection to remake it after process
    322.         int backupPos = te.pos;
    323.         int backupSelPos = te.selectPos;
    324.  
    325.         //get last position in text
    326.         te.MoveTextEnd ( );
    327.         int endpos = te.pos;
    328.         //draw textfield with color on top of text area
    329.         UpdateText ( te, ev, endpos, textStyle, backupPos, backupSelPos );
    330.  
    331.         //Reset color
    332.         GUI.color = backupColor;
    333.         GUI.contentColor = backupContentColor;
    334.         GUI.backgroundColor = backupBackgroundColor;
    335.  
    336.         GUI.EndScrollView ( );
    337.     }
    338.  
    339.     private void CheckFileOptions (TextEditor te )
    340.     {
    341.         FileStream fs;
    342.         StreamWriter sw;
    343.         string path;
    344.         if ( toolbarMenuIndex == -1 )
    345.             return;
    346.         switch ( toolbarMenuIndex )
    347.         {
    348.             //New
    349.             case 0:
    350.                 this.path = "";
    351.                 textStyle = new GUIStyle ( GUI.skin.textArea );
    352.                 s = "";
    353.                 redos.Clear ( );
    354.                 break;
    355.  
    356.             //Open
    357.             case 1:
    358.                 path = EditorUtility.OpenFilePanel ( "Load...", "", "*.*" );
    359.                 if ( path != "" )
    360.                 {
    361.                     this.path = path;
    362.                                    
    363.                     textStyle = new GUIStyle ( GUI.skin.textArea );
    364.                     bool fileIsOpen = false;
    365.                     if ( fileTabs.Count > 0 )
    366.                     {
    367.                         for ( int i = 0; i < fileTabs.Count; i++ )
    368.                         {
    369.                             Tab t = fileTabs [ i ];
    370.                             if ( t.filePath  == path )
    371.                             {
    372.                                 fileIsOpen = true;
    373.                             }
    374.                         }
    375.                         if ( !fileIsOpen )
    376.                         {
    377.                             s = "";
    378.                             lines = 0;
    379.                             LoadFile ( path );
    380.                         }
    381.                     }
    382.                     else
    383.                     {
    384.                         s="";
    385.                         lines = 0;
    386.                         LoadFile (path );
    387.                     }
    388.  
    389.                 }
    390.                 redos.Clear ( );
    391.                
    392.                 break;
    393.  
    394.             //Save
    395.             case 2:
    396.                 fs = new FileStream ( this.path, FileMode.Open );
    397.                 fs.SetLength ( 0 );
    398.                 fs.Close ( );
    399.                 sw = new StreamWriter ( this.path );
    400.                 sw.Write ( s );
    401.                 sw.Close ( );
    402.                 AssetDatabase.Refresh ( );
    403.                 break;
    404.  
    405.             //Save as
    406.             case 3:
    407.                 path = EditorUtility.OpenFilePanel ( "Save as...", "", "*.*" );
    408.                 if ( path != "" )
    409.                 {
    410.                     this.path = path;
    411.                     fs = new FileStream ( path, FileMode.Open );
    412.                     fs.SetLength ( 0 );
    413.                     fs.Close ( );
    414.                     sw = new StreamWriter ( path );
    415.                     sw.Write ( s );
    416.                     sw.Close ( );
    417.                     AssetDatabase.Refresh ( );
    418.                 }
    419.                 break;
    420.  
    421.             //Close
    422.             case 4:
    423.  
    424.                 break;
    425.  
    426.             //Close all
    427.             case 5:
    428.  
    429.                 break;
    430.         }
    431.         toolbarMenuIndex = -1;
    432.     }
    433.  
    434.     private void LoadFile (string path)
    435.     {
    436.         StreamReader sr = new StreamReader ( path );
    437.         string newText = "";
    438.         while ( !sr.EndOfStream )
    439.         {
    440.             string newLine = sr.ReadLine ( );
    441.             newText += newLine + "\n";
    442.         }
    443.         int index = path.LastIndexOf ( "/" );
    444.         string file = path.Substring ( index+1);
    445.         sr.Close ( );
    446.         fileTabs.Add ( new Tab ( file, path, newText ) );
    447.         fileTabIndex = fileTabs.Count-1;
    448.         s = newText;
    449.         tSize.y =  textStyle.CalcHeight ( new GUIContent ( s ), position.width );
    450.         tSize.x = position.width;
    451.         Repaint ( );
    452.     }
    453.  
    454.     private void CheckEditOptions (TextEditor te )
    455.     {
    456.         if ( toolbarMenuIndex == -1 )
    457.             return;
    458.  
    459.         switch ( toolbarMenuIndex )
    460.         {
    461.             //Cut
    462.             case 0:
    463.                 te.Cut();
    464.                 s = te.content.text;
    465.                 break;
    466.  
    467.             //Copy
    468.             case 1:
    469.                 te.Copy();
    470.                 break;
    471.  
    472.             //Paste
    473.             case 2:
    474.                 te.Paste();
    475.                 s = te.content.text;
    476.                 break;
    477.         }
    478.  
    479.         toolbarMenuIndex = -1;
    480.     }
    481.  
    482.     void UpdateText (TextEditor te, Event ev, int endpos, GUIStyle textStyle, int backupPos, int backupSelPos )
    483.     {
    484.         te.MoveTextStart ( );
    485.         lines = 0;
    486.         while ( te.pos != endpos )
    487.         {
    488.             te.SelectToStartOfNextWord ( );
    489.             string wordtext = te.SelectedText;
    490.  
    491.             //set word color
    492.             GUI.contentColor = CheckSyntax ( wordtext );
    493.  
    494.             Vector2 pixelselpos = textStyle.GetCursorPixelPosition ( te.position, te.content, te.selectPos );
    495.             Vector2 pixelpos = textStyle.GetCursorPixelPosition ( te.position, te.content, te.pos );
    496.  
    497.             GUI.TextField ( new Rect ( pixelselpos.x - textStyle.border.left - 2f , pixelselpos.y - textStyle.border.top, pixelpos.x, pixelpos.y ), wordtext);
    498.             if(wordtext.Contains("\n"))
    499.                 lines++;
    500.             te.MoveToStartOfNextWord ( );          
    501.         }
    502.         lines++;
    503.  
    504.         //Reposition selection
    505.         Vector2 bkpixelselpos = textStyle.GetCursorPixelPosition ( te.position, te.content, backupSelPos );
    506.         te.MoveCursorToPosition ( bkpixelselpos );
    507.  
    508.         //Remake selection
    509.         Vector2 bkpixelpos = textStyle.GetCursorPixelPosition ( te.position, te.content, backupPos );
    510.         te.SelectToPosition ( bkpixelpos );    
    511.     }  
    512.  
    513.     Color CheckSyntax (string syntax )
    514.     {
    515.         string newSyntax = syntax.TrimEnd ( ' ' );     
    516.         foreach ( string st in cNamespaces )
    517.         {          
    518.             if ( newSyntax == st  !isCommenting)
    519.                 return Color.cyan;
    520.         }
    521.  
    522.         if ( newSyntax.StartsWith ( "//" ) || newSyntax.StartsWith ( "*/" ) )
    523.         {
    524.             isCommenting = true;
    525.             if ( newSyntax.StartsWith ( "*/" ) )
    526.                 commentAffectsNextLine = true;
    527.             return Color.green;
    528.         }
    529.  
    530.         if ( newSyntax.StartsWith ( "\"" ) || newSyntax.StartsWith ( "\'" ) )
    531.         {
    532.             isString = true;
    533.             return Color.magenta;
    534.         }
    535.  
    536.         if ( newSyntax.StartsWith ( "/*" ) )
    537.         {
    538.             commentAffectsNextLine = false;
    539.             return Color.green;
    540.         }
    541.  
    542.         if ( isString  newSyntax != "\n" !isCommenting )
    543.             return Color.magenta;
    544.  
    545.         if(isCommenting  newSyntax != "\n")
    546.             return Color.green;
    547.  
    548.         if(isCommenting  (newSyntax == "\n"  commentAffectsNextLine ))
    549.             return Color.green;
    550.  
    551.         if ( newSyntax == "\n" )
    552.         {
    553.             isCommenting = false;
    554.             isString = false;
    555.         }
    556.  
    557.         return Color.white;
    558.     }
    559.  
    560.     void CheckKeys (TextEditor te, Event ev )
    561.     {
    562.         if ( GUIUtility.keyboardControl==te.controlID   ev.Equals ( Event.KeyboardEvent ( "tab" ) ) )
    563.         {
    564.             Debug.Log ( "tab pressed" );
    565.             GUI.FocusControl ( "TextArea" );
    566.             if ( s.Length > te.pos )
    567.             {
    568.                 s = s.Insert ( te.pos, "\t" );
    569.                 te.pos++;
    570.                 te.selectPos = te.pos;
    571.             }
    572.             ev.Use ( );
    573.             GUI.FocusControl ( "TextArea" );
    574.         }
    575.  
    576.         if ( ( Event.current.type == EventType.KeyUp )  ( Event.current.keyCode == KeyCode.Space )  ( GUI.GetNameOfFocusedControl ( ) == "MyTextArea" ) )
    577.         {
    578.             Debug.Log ( "space pressed" );
    579.         }
    580.  
    581.         if ( ( Event.current.type == EventType.KeyUp )  ( Event.current.keyCode == KeyCode.Return )  ( GUI.GetNameOfFocusedControl ( ) == "MyTextArea" ) )
    582.         {
    583.  
    584.             Debug.Log ( "Enter pressed" );
    585.             if ( s.Length > te.pos )
    586.             {
    587.                 s = s.Insert ( te.pos, "\t" );
    588.                 te.pos++;
    589.                 te.selectPos = te.pos;
    590.             }
    591.             ev.Use ( );
    592.         }
    593.     }
    594. }
    595.  
     
    Last edited: Jun 29, 2013
  2. Cheburek

    Cheburek

    Joined:
    Jan 30, 2012
    Posts:
    382
    Sounds interesting. Can you debug with it? Also what other advantages does it have over mono or vs?
     
  3. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    What ever the community wants to add to it to make it better, it's open source. And I do plan to add debugging and error reporting. So yea if any one wants to add to this system and post what they added they can. As for advantages to vs or mono - the only current one is this has no load time. It's run inside the editor so you never have to leave Unity to script and when you save it updates the editor.
     
  4. rbx775

    rbx775

    Joined:
    Aug 16, 2010
    Posts:
    100
    most interesting project right now :)

    I code/script in notepad++ at the moment, but I never got it to work with the unity debugging feature. :/
    if you'd manage to enable debugging with yours I would consider leaving my beloved notepad++

    I'd love to have "duplicate lines" with strg+D and "Line swapping" via strg+T (both Notepad++ features) in your unity script editor :)

    awesome idea, btw. thrilled to see more.
     
  5. Asvarduil

    Asvarduil

    Joined:
    Nov 19, 2009
    Posts:
    3,807
    You should get this on a GitHub repository of some kind, and give the community the link. Personally, I'd be interested in building fully-featured refactoring tools into this, as I don't think anything short of a VS install with ReSharper has in-depth refactoring capability.
     
  6. AlexLeighton

    AlexLeighton

    Joined:
    Sep 3, 2012
    Posts:
    99
    I love the idea of not having to switch between programs, awesome stuff!
     
  7. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    Added two menu items - File and Edit
    File contains options for creating, loading and saving files.
    Edit contains options for cutting, copying and pasting text.
    Also you can now open multiple scripts at one time. They are stored in tabs in an upper menu bar.

    Uploading soon.
     
  8. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    Ok, on my first post I updated the script at the bottom to the current version. Enjoy :D
     
  9. carl010010

    carl010010

    Joined:
    Jul 14, 2010
    Posts:
    122
    I typed in hello world and got dlrow olleh
    $ScriptEditor.png
    Maybe I didn't set the script right, not really sure. Really would appreciate some help. Oh and before I go I really appreciate your hard work on this quite amazing asset. Thank you.

    Carl
     
    Last edited: Jun 29, 2013
  10. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    Fixed Carl, just recopy the script and all should be good ^^.
     
  11. carl010010

    carl010010

    Joined:
    Jul 14, 2010
    Posts:
    122
    Hey man, I hate to be a bearer of bad news but Im running Mac OS X and I can not load or save scripts, which kind of throws a wrench in me using this plug-in.
     
  12. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    You can't load or save... I have no mac so I'm not aware of this error... What does it say / do?
     
  13. carl010010

    carl010010

    Joined:
    Jul 14, 2010
    Posts:
    122
    When I try to load a script, it goes to Finder(mac way of searching through files) like it should to find and open a script, but all the scripts are grey like they are not a file that this program could use. Save as does the same thing it try's to open a file rather then save a new file. Clicking save gives me

    ArgumentException: Path is empty
    System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.IO/FileStream.cs:209)
    System.IO.FileStream..ctor (System.String path, FileMode mode)
    (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode)
    ScriptEditor.CheckFileOptions (UnityEngine.TextEditor te) (at Assets/-mine/scripts/ScriptEditor.cs:789)

    when I double click it it sends me to line 789
    Code (csharp):
    1. fs = new FileStream ( this.path, FileMode.Open );
     
  14. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    782
    I think the FileStream class is a windows-only thing, just guessing

    You probably need to do some #if #endif statements for the different platforms, as each has it's own way of loading and saving files etc
     
  15. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    this is handy to know. i wish i had a mac to test this on lol. If any one can help with this mac issue it would be greatly appreciated. I'll try and figure it out my self as well.
     
  16. carl010010

    carl010010

    Joined:
    Jul 14, 2010
    Posts:
    122
    Any thing new?
     
  17. carl010010

    carl010010

    Joined:
    Jul 14, 2010
    Posts:
    122
    slkjdfv any progress?
     
  18. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,356
    No it isn't. The exception is stating that this.path is null.
     
  19. carl010010

    carl010010

    Joined:
    Jul 14, 2010
    Posts:
    122
    you still working on this?
     
  20. slkjdfv

    slkjdfv

    Joined:
    Oct 23, 2010
    Posts:
    424
    This is opensource, this project also relies on others to contribute and add to this system. I am working on this project but only in my spare time. I have other projects that are more important at the moment. If anyone wants to contribute something it would be greatly appreciated. :) So the answer is yes I am still working on it but it's on the bottom of my list for now sorry.
     
  21. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    185
    This is actually super useful as a starting point for something I'm working on - can I check the license, I know you've said open source; can you qualify which one? (MIT or public domain would be ideal)

    Thanks!