Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Script Inspector 3 - World's Fastest IDE for Unity

Discussion in 'Assets and Asset Store' started by Flipbookee, Jun 2, 2012.

?

What would you like to see in the next update?

Poll closed May 17, 2018.
  1. Line numbers

    140 vote(s)
    36.9%
  2. Code folding

    234 vote(s)
    61.7%
  3. More color schemes

    43 vote(s)
    11.3%
  4. Customizable color schemes

    71 vote(s)
    18.7%
  5. Search functionality

    152 vote(s)
    40.1%
  6. Lower price :D

    104 vote(s)
    27.4%
  7. No thanks, it's fine as it is :)

    11 vote(s)
    2.9%
Multiple votes are allowed.
  1. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @RainbowWhale, in what Unity version exactly, on what OS, and what is your version of Si3? Please update to the latest Si3 version 3.0.24 if you’re on something older than that, as there keyboard shortcuts related fixes in that release.
     
  2. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    @Flipbookee

    minor bug with "tab". When I press tab between variable declaration and assignment, the whole line get's tabbed, instead of the right part only.

    This happens occasionally. LAtest SI3 version on Mac with UNity 2018.3.0f2

    Code (CSharp):
    1.  
    2. var myVariable                               = new Vector3(0,0,0);
    3.                                        ^
    4.                                         |
    5.            var myVariable                               = new Vector3(0,0,0);
    6.    
     
    Flipbookee likes this.
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @sngdan I tried this, but it doesn't happen for me. Could it be that you had selected the space character left of the equals sign maybe? That would explain the whole line getting tabbed, which is the intended behaviour in that case.
     
  4. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    I just went into a c# script and pressed "TAB" at all kind of random places

    Code (CSharp):
    1. inputDependencies    = job.Schedule(this, inputDependencies);
    2. // pressed tab behind semicolon -> whole line tabbed
    3.  
    4.         if (point.y > max.y) return false;
    5. // pressed tab behind semicolon -> line not tabbed (tab after semicolon)
    6.  
    7.         jobHandle = new FlagCollidingEntitiesJob
    8.         {
    9.             DistinctCollisionEntityHashMap        = distinctCollisionEntityHashMap
    10.         }.Schedule(this, jobHandle);
    11.  
    12. //  pressed "Tab" before "=" but not directly adjacent to "p" and not to "=", i.e. somewhere in the middle, whole line "tabbed" tried to undo, to see where it was, the last character of "DistinctCollisionHashMap" was deleted, i.e. the "p"



    side note: 2018.3.0f2, latest SI3, Mac, using ECS package (some things don't get resolved there but that's kind of expected)

    Code (CSharp):
    1. if (DistinctCollisionEntityHashMap.TryGetValue(e.GetHashCode(), out int item))
    2.  
    3. item would not be recognized...
     
    Flipbookee likes this.
  5. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    another suggestion....add an option to include "packages" in the search / replace and find all references / goto definition, etc...
     
    Flipbookee likes this.
  6. dpizzle

    dpizzle

    Joined:
    Feb 2, 2013
    Posts:
    31
    I use find globally a lot (Command-Shift-F). And it pops up the shortcut conflict detected message in 2018.3.1 in console. From what I understand we won't be able to reassign keys in Unity until 2019 version. I assume the only way to fix this until 2019 is to change the key command in script inspector code since this isn't a normally editable key command in the preferences. I'm ok with this, just making sure I'm not missing something.
     
    Flipbookee likes this.
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hi @dpizzle and excuse me for replying late. That's what I understood too, we won't be able to reassign keyboard shortcuts until Unity version 2019.1, and yes, one way to fix this until then is to change that in Si3.

    One thing I'm not sure though is, by "find globally" do you mean you've been accessing Si3's Find in Files command from other windows/tabs in Unity? Because there was an option in Si3 Preferences to allow that, so what I'm going to do now is I'll remove that option and change the shortcut to Alt-Shift-Cmd-F for accessing that feature from other tabs, while from Si3 tabs I'll try to keep it as it used to be, Shift-Cmd-F. I'm planning to release an updated version of Si3 with that change tomorrow, and till then you can change the keyboard shortcut to Alt-Shift-Cmd-F (or something else if you wish, just note that Alt-Cmd-F is also taken by Unity) in Si3 source code like this:

    Open FindReplaceWindow.cs and go to line 106 - you should see this code:
    Code (csharp):
    1.     [MenuItem("Window/Script Inspector 3/Find in Files... _%#f", false, 600)]
    2.     public static void ShowFindInFilesWindow()
    Then set the new shortcut you'd like to use in the MenuItem attribute, like this for example:
    Code (csharp):
    1.     [MenuItem("Window/Script Inspector 3/Find in Files... _&%#f", false, 600)]
    2.     public static void ShowFindInFilesWindow()
    Then just save that and let Unity recompile Si3...

    I hope this helps for now. :)
     
  8. dpizzle

    dpizzle

    Joined:
    Feb 2, 2013
    Posts:
    31
    Thanks, @Flipbookee, amazing support as usual. Will have to change my muscle memory, but nothing I can't handle. Appreciate it.
     
    Flipbookee likes this.
  9. rpgw

    rpgw

    Joined:
    Jul 3, 2012
    Posts:
    47
    I too have found the editor to be very unstable recently on OSX, using editors 2018.3+ through to latest 2019 beta. I don't know if SI3 is actually responsible, the log seems to mention GFX? But I am always using or typing into SI3 when I get a crash, sometimes a lock up, other times an instant dump to desktop. SI3 has always seemed rock-solid in every version I have used in the past so maybe this is something else. Here's a crash log. Hope it is useful! :)

    Using SI3 version 3.0.24, January 2019
     

    Attached Files:

    Flipbookee likes this.
  10. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Thanks @rpgw, I very much appreciate your help! This is a similar crash log as the other one I received and which I wasn't able to reproduce so far. Although, this is a crash in the latest alpha. Please send me all your Unity crash log if you can and have more than only this one.

    I've switched to working with Si3 on my MacBook fully in hope I'll get that reproduced...

    If you could share your project with me, that may be a great help. If you can manage to get the crash easily, please capture a video... I'm kind of out of ideas, so any help may lead to some clue... Thanks!
     
  11. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    Hi
    - I still have the ocassional glitches with tab & I noticed that also arrow-up/down sometimes does not work (when I use left arrow and reposition, arrow-up/down work again and go to the respective line)
    - is is possible to include certain packages in the search, references, etc?
    - when using unsafe most of the script becomes unrecognized

    This is on a Mac with ecs/jobs package. 2018.3

    Still only using SI3 for coding!
     
    Flipbookee likes this.
  12. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Those glitches when inserting a tab are really weird and I wasn’t able to reproduce them so far. Please tell me what settings do you use for:
    - Tabs vs. spaces
    - Tabs size
    - Word wrapping
    (maybe I’ll get that reproduced with the same settings)

    I’ve noticed the up and down arrows not moving sometimes, precisely after typing a number. This should be an easy fix.

    I’ve been looking at including packages in search results. It’s possible, of course, just needs to be done...

    Thanks for representing the issue with unsafe code! I wasn’t aware of that. It should be an easy fix as well.
     
    sngdan likes this.
  13. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    standard settings:
    - tabs
    - tab size 4
    - word wrapping SI3 Tabs OFF, Inspector Tab ON

    It only occurred to me, when I changed the formatting for assigning variables in jobs.
    Typically I always just had one space, like so
    abc = Variable1
    defghij = Variable2

    which I changed to
    abc[tab][tab][tab] = Variable1
    defghij[tab][tab][tab] = Variable2

    and when a name gets longer and I want to add some extra [tab] to align the "=" sign, suddenly the whole line from the beginning moves...

    If I am the only one with this issue, forget about it
     
    Flipbookee likes this.
  14. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    144
    Hi there, is it possible to have more file tabs showing on the horizontal bar ? It seems to be taking as many as 8-9 files max before getting out of view. It's quite annoying not having them show without clicking on the dropdown. Is it maybe possible to extend the bar so that it has like two rows of opened tabs or so ?

    Thanks !
     
    Flipbookee likes this.
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hey, hey, all you extremely fast code-editing addicts! Here's a small present for you :cool:

    Script Inspector 3
    version 3.0.25
    got just released on the Asset Store

    This is what's new in it:
    - Added option to auto-move opening brace to next/empty line - thanks @RainbowWhale
    - Updated setting Si3 tabs position for Unity 2018.3+ - thanks @jrDev
    - Fixed saving of docked/floating state of Si3 tabs
    - Fixed keyboard shortcut for the Find in Files command - thanks @dpizzle & @jrDev
    - Fixed up/down arrow keys not working sometimes - thanks @sngdan
    - Other minor fixes

    Thank you all for helping me with this release!

    Enjoy :D
     
    mgsvevo, sngdan, rpgw and 1 other person like this.
  16. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    Good update! Thx. Still my most used asset.

    I recently had to update to 2019.0.1b5 (for ECS) and although it is still in beta, just a heads up on the first things, I noted:
    - UI does not have (x) on the panels anymore, seems to be for all windows
    - The Inspector panel changed - I can see the SI3 code as usual, but I can no longer edit it in the Inspector panel, nor copy from it

    Overall working fine though, even in 2019.0.1b5 - I feel with you, it must be really time consuming to keep up with all the Unity version changes.

    I mentioned this earlier, what would be great is if you could somehow find a way to enable "Packages" to be included in the scope of SI3, i.e. I can "Go to definition" in the scripts that are included in "Assets" but to the scripts included in "Packages"
     
    Flipbookee likes this.
  17. mgsvevo

    mgsvevo

    Joined:
    Apr 10, 2014
    Posts:
    20
    Hi @Flipbookee ,
    Just thought I should let you know of a small bug.
    The problem that make autocomplete popup draws behind the Script Inspector window when it is not docked it got solved in version 3.0.24,
    but still when i click on the autocomplete popup with the mouse it draws again behind the Script Inspector window even in the last update.
     

    Attached Files:

    Flipbookee likes this.
  18. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Ough, that's bad... Thanks, I'll it!
     
    mgsvevo likes this.
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    I tried to reproduce this issue on both PC and Mac in different Unity versions, but it doesn't happen for me. Can you tell me on what OS and Unity version exactly did that happen?
     
    mgsvevo likes this.
  20. mgsvevo

    mgsvevo

    Joined:
    Apr 10, 2014
    Posts:
    20
    I'm working in windows and the problem happened in unity 2018.3.0f1 and 2019.1.0b8 and only when the script inspector window is not docked with the unity editor
     
    Flipbookee likes this.
  21. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Right, I see the issue in Unity 2018.3.0 now. I was trying that in a newer version... I'll try something, thanks!!!
     
    mgsvevo likes this.
  22. codywulfy

    codywulfy

    Joined:
    Mar 28, 2017
    Posts:
    1
    Hi! I recently bought this asset and looks pretty solid, just two things bother me.
    1. Why doesn't it recognize when I reference a custom script? On Visual Studio I am able to reference personal scripts easily but not on SI3
    2. Why does it take SO LOOOOOOOOOONG to "compile and reload assemblies"? Like I have to force quit Unity to be able to use it again.
    Can you please help out? Thanks
     
    Flipbookee likes this.
  23. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Sure, I'll try... I'm just not sure what you mean by "reference a custom script" - can you explain, please?

    Your second question sounds like a bug, so I'll need more info about that. Much more info, actually...

    First off, let me say that Si3 doesn't compile the code. That's still done by Unity itself, therefore there should be no difference in how long it takes to compile and reload assemblies with or without Si3. The only thing that requires only slightly more time, a couple of milliseconds which is unnoticeable, with Si3 is the time it takes to serialize and deserialize the state of Si3. That's so tiny fraction of time that I'm excluding it as a possible reason for what you're experiencing.

    When you say "it takes so loooong" do you really mean it never finishes or if you'd wait long enough it would finish eventually?

    The easiest way for me to reproduce the issue would be if you could share that Unity project with me. If that isn't possible, then I'd have to at least know what OS you're using and the exact version of Unity this is happening in. Besides that, I'd need to know what build target is currently selected in your project and what is the scripting runtime set for it.

    Please let me know these things first, then I may have to ask you for some more info, if needed... If you don't mind, could you also check this in a new empty Unity project and tell me what's the difference?
     
    Novack and codywulfy like this.
  24. winxalex

    winxalex

    Joined:
    Jun 29, 2014
    Posts:
    166
    Now we can code and design runtime.
     
    Lars-Steenhoff and Flipbookee like this.
  25. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    101
    Hi there!

    I don't know if you remember, but you quoted my 5* review a while ago. I'm glad you can see past the negative spam bots because SI is great.

    I have a question, a bug, and a feature-request! I hope you don't mind, I'm putting it on one post for efficiency. The first 2 relate to tooltips, the features relate to saving.

    First of all, are your autocomplete tooltips able to detect descriptions from functions that I write? I have a function that requires an int as a parameter, each number represents a state, I would like the tooltip to show people an example of what the numbers represent. I have tried using "///" and "///<summary>" with "param name" to no avail.

    The bug is that in recent unity builds (possibly > 2018.1), these tooltips started "sticking" when you switch tabs. Start typing to bring one up and then change tabs, the tooltip can't be removed until you return to that tab.

    The feature requests are quite straight forward. Could we optionally have CTRL+S also save the scene, and also have the option not to compile when pressing play, like CTRL+Click play plays with no autocompile? In relation to compiling, are you able to prevent unity from compiling when I create a new script? As I have to wait for it to compile before I can start typing. It would be cool to see this as a "new script" icon before new tab, which just creates a new tab with an empty input area (maybe adds the default monobehaviour template) but only "keeps in memory" until you save. As a bonus, a custom "new Scripts save location" in the settings would be a dream.


    Thank you so much for reading this and creating script inspector, forgive my enthusiasm!
     
    Last edited: May 2, 2019
  26. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hi all! I've been traveling for the last couple of weeks and I couldn't follow this thread - sorry about the delay. I'll be back in about a week and then continue working on Si3... Thanks for your patience! :)

    Thanks again for your support! :D

    Currently no, because of the way how Si3 works it only parses and does code analysis for edited scripts, while for all the other script it collects info using .Net reflection. That's one of the reasons why it's so fast... Anyways, I'm aware that this approach is not ideal for cases like yours - code comments are not available through reflection, so I've been looking for a couple of options to achieve that while still keeping Si3 as fast as it is now. I'll get to implementing that one day eventually.

    Yup, someone else reported that to me and I think that's my fault - I changed how popup windows work in recent versions in order to make it compatible with recent changes inside Unity Editor, but I didn't notice this issue. It should be an easy fix, thanks for reporting it!

    Thanks for these great suggestions! I'll see what I can do about them... Saving the scene should be an easy option to add. I'm not sure is it possible to skip compiling on Play, but I think it is. Not compiling on creating a new script would be a little more work, but far from not doable, and it would be great to have that feature! Also, the custom save location, yes, that would be a dream :cool:

    Sorry, I can't forgive you :p without that kind of enthusiasm Si3 would be a very boring thing to use. That's what makes the difference between an average okay-ish product and something surprisingly good and occasionally really amazing.
     
    User340 and Lars-Steenhoff like this.
  27. Grumpy-Dot

    Grumpy-Dot

    Joined:
    Feb 29, 2016
    Posts:
    93
    @Flipbookee Hello, SI3 is not working for me as expected for Unity 2019.1.x. The SI Console is working great, I get no errors, except a warning of a deprecated PreferenceItem attribute, but I can't edit any of the scripts in the Inspector Tab.
    The only way I can edit scripts is to set SI3 as the default editor and open it into a dedicated window.
    The issue with the Inspector tab is that I do not get a blinking text cursor and I can't write anything in the script. I am able however to select text and copy it, but no matter how much I click the text in in inspector tab, I do not see the text cursor, and I can't type anything.
    I am using Windows. Let me know if there is anything I can help with to isolate this bug. The plugin works as expected for Unity 2018.3.x, only 2019.1.x has the issue.
    Also, please fix the warning as well, if you have the time.
    Thanks!
     
    Last edited: May 26, 2019
    Flipbookee likes this.
  28. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Yeah, I know about the issue in Inspector tab in Unity 2019.1.x and I'll fix it. I hope I will, I was trying yesterday to find out what broke it and I couldn't find anything. I'll try again today...

    Sure, I'll fix the warning as well, at least I know what has to be done about that :)
     
    Grumpy-Dot likes this.
  29. maydragon

    maydragon

    Joined:
    Aug 27, 2018
    Posts:
    8
    Hi, Flipbookee.

    I tried to glimpse over the SI3's code and the problem led me to this part on file FGTexEditor.cs:

    Code (CSharp):
    1.  
    2. hasCodeViewFocus = GUIUtility.keyboardControl == codeViewControlID;
    3.             if (hasCodeViewFocus && Event.current.rawType != EventType.MouseUp)
    4.             {
    5.            
    6.                 EditorWindow wnd = EditorWindow.focusedWindow;
    7.                 if (wnd == null)
    8.                 {
    9.                     hasCodeViewFocus = false;
    10.                 }
    11.                 else if (wnd != autocompleteWindow)
    12.                 {
    13.                     hasCodeViewFocus = wnd == OwnerWindow;
    14.            
    15.                 }
    16.             }
    17.  
    18.             if (hasCodeViewFocus)
    19.                 Input.imeCompositionMode = IMECompositionMode.On;
    20.  
    The variable OwnerWindow is always returning NULL.

    I tried to set "hasCodeViewFocus = true" just above "if(hasCodeViewFocus)" and all of a sudden the text editor in the Script Window was unlocked and able to receive text input. But the buttons and the search bar are still locked, though.

    Hope this helps.
     
    Grumpy-Dot and Flipbookee like this.
  30. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Aaaaaah :eek: that makes sense now!!! Excellent find, thanks so much! I’ll fix this and the buttons, of course. It will be easy now that I know what was causing it...
     
  31. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Hi everryone,

    Flipbookee invited me to post a notice here - thanks @Flipbookee. Really appreciate it.

    Flipbookee kindly gave me a key for script inspector a while ago and it's been absolutely brilliant in use all this time. It's more than played it's part in helping me finish this game. The amount of time saved has been really noticeable. When your project get's this big you really see how slow opening scripts and projects in alternative IDE's can become. At least it was the case for me. Thanks Flipbookee for making this great tool!

    So here it is. My game is finally finished. After what seems like forever, working alone, starting from a complete beginner to a now jack of all trades and master of none. It's been a real journey but I think it's genuinely a really good game. One I've tried to make bug free and fun with lot's of character and replay value. I've also tried to add new and fresh ideas to a classic genre.

    For anyone who'd like to support a now financially desperate and pretty burned out new indie game developer :) by purchasing a copy of one of the greatest bargains of the century while it's on a finally finished and newly released celebration sale then just click on one of the links below.

    Cheeky Beetle and the Unlikely Heroes

    https://store.steampowered.com/app/1054180/Cheeky_Beetle_And_The_Unlikely_Heroes/


    https://play.google.com/store/apps/details?id=com.Rocksoft_Ltd.Cheeky_Beetle_And_The_Unlikely_Heroes


    https://www.amazon.co.uk/Rocksoft-L...ky+beetle+and&qid=1559654631&s=gateway&sr=8-1


    Apple App Store - https://itunes.apple.com/us/app/cheeky-beetle/id1453590784?ls=1&mt=8





    Linux version for Steam are in testing. Hopefully out soon.
    MacOs version due for testing soon.

    Twitter - @RocksoftLtd

    Thanks for your time everyone:).
     
    JoeStrout, Flipbookee and maydragon like this.
  32. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Its been a month since then, I sense that this update will not be mere fix, but a big one..!
    Will code folding finally come in the next update? :p:p:D:D

    Also, suggesting an optional feature to have different bracket colors for each bracket pairs.
    Recently saw this on Twitter, and it might be helpful for complex formulas. (Being able to immediately tell which bracket is paired with which!)
    Bracket Color.jpg
     
    Flipbookee and Jaimi like this.
  33. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    +1 for Rainbow Brackets :)
    Plugins for coloured brackets are available on virtually any coding IDE out there, maybe this could be a fine contribution from the community, hehe.
     
  34. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    101
    Great job in finding this. To clairfy for anyone else with this issue, for now you can add
    hasCodeViewFocus = true; At line 3469

    @Flipbookee I hope you're still alive and well!
     
    Flipbookee and JoeStrout like this.
  35. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Thanks @haywirephoenix! I've got a proper fix for that issue waiting to be released this weekend, which is a long weekend over here and I'm so much looking forward to it.
     
  36. RavenWoodsDE

    RavenWoodsDE

    Joined:
    Jul 13, 2015
    Posts:
    12
    Hrm, is it just me that on 2019, it's actually slower on compile than Visual Studio? Tried on both a clean new project and an old one. Gotta close it sometimes in order to get on with doing stuff. It's definitely the plugin holding the editor up
     
  37. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    I'll check that, thanks! Si3 is bundled in a custom assembly that once compiled shouldn't affect the compile time at all, but yeah, I'll better check what's going on. I haven't noticed anything like that so far, but it may be because I don't use VS for coding in Unity. Anyway, I'll check this and in meantime keep in mind that Si3 doesn't compile the code, but that's still done by Unity, so the compile time shouldn't be any different.
     
  38. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Visual Studio 2019 starts compilation in Unity as soon as you hit save on the code file. Depending the situation, that can create the impression that Unity compiles faster.
     
    Last edited: Aug 19, 2019
    User340 and Flipbookee like this.
  39. yomilonge

    yomilonge

    Joined:
    Aug 18, 2019
    Posts:
    5
    Hi Flipbookee
    Any plans to support the C# 6.0 features in Si3 like...

    Code (CSharp):
    1. obj?.SomeMethod();
    ...or am I missing something, and it's already supported.
    I'm using quite a few of the (no longer new .Net 4.7) c# 6 features, which compile and work, however Si3 sees it all as an error, and then unfortunately reports the whole code as full of errors.

    (see pic below)
    upload_2019-8-19_0-13-16.png
    It makes this brilliant tool lose a bit of its shine.

    Again apologies if it is already supported.
    Thanks
     
    Last edited: Aug 19, 2019
    Flipbookee, Grumpy-Dot and User340 like this.
  40. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    Hey, I'm that guy who every year comes back and says "Any chance we can use this in an editor?".

    Well. I'm back :).
     
    Flipbookee likes this.
  41. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hi @yomilonge! No, you didn't miss anything - C# 6.0 is not supported in Si3 yet... I know it's been available in Unity for a while already, but I've been struggling to keep the existing Si3 functionality working in the latest versions of Unity, which takes all my free time and there's nothing left for more features these several last months already. As I said earlier, I'll be adding the new C# features gradually starting with the most commonly used ones, like the "?." operator for a start, but I have nothing of that to offer at this moment.

    The reason for that is simple - Si3 is not using any external C# parsing and code analysis libraries, neither it embeds a full external IDE inside Unity. All the code is hand-crafted by me and written in a way to specifically work inside the Unity Editor, giving the maximum performance by using the minimum hardware resources. Those are the benefits of this approach, but there are also some drawbacks, like for example that the newer versions of C# do not get supported just like that by themselves and me doing nothing, maybe not even knowing about them, as it would be the case if I'd be using external libraries or applications...

    However, I feel your pain and resolving issues like this is one of my top priorities! I hope you'll find an alternative solution in the meantime.
     
    Lars-Steenhoff and syscrusher like this.
  42. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Yeah, hi @DGordon! I have no good news for you, unfortunately. There are, as you can see here, some very hot other things I have to take care of first... Embedding Si3 in other editors is still a feature I wish to add, but currently, it would be unrealistic to expect that soon.
     
    syscrusher likes this.
  43. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Just tried the 2020.7 alpha, just for testing, and there are no compile errors, but I cannot edit a script with si3.
    I'm not expecting it to work in alpha, but just to let you know my finding.
     
    Flipbookee, Gekigengar and Novack like this.
  44. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Thanks @Lars-Steenhoff, I'll check what's going on!
     
    Lars-Steenhoff likes this.
  45. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    I finally attempted to get SI3 working in custom editors, and I'm actually having success with my intial forays! My use-case is I have custom editors with c# snippets that save out the final c# files (ie: Dialog and Quest editors, among many many others). All I want from this is to have a proper code textbox for those c# snippets to be written in.

    I'll eventually share more if I get this to a real production ready state, but I have a quick question.

    The first line of each editor's file is a wrapper of using statements/class/function, just because its required to get the syntax stuff working properly for the snippets I want to write. The last line is a wrapper of the closing braces. I only _care_ about the content in the middle, so I'll have an easy way to grab the text with those lines stripped out ... they're just here to have the code textbox actually work.

    code_editor_full.PNG

    I figured out how to hide these with your HideLine command (and I built a ShowLine command to turn it back on, since I have to change the last line to hide whenever the number of lines changes). I also block the arrow keys / delete / backspace keys from working with the first and last lines. I also manually force the cursor and selection out of those lines if I see the user got it there somehow. All told, so far, its _pretty_ stable in not letting the user even know theres more text in there, and I'm sure I can solve any edge cases I find.

    code_editor_hidden.PNG

    What I don't like is that the indent for the code I _want_ to see is still using the indentation based on the hidden first line. It starts off fine because the text in the file doesn't have the indent, but the moment I interact with it, the auto-indent pushes it right.

    I assume this is happening in in FGTextBuffer.CalcAutoIndent which is called by FGTextEditor.ReindentLines.

    code_editor_reindent.PNG
    What I haven't been able to figure out is how to easily get the indentation code to ignore the very first indent. I basically want the equivalent of indent only starting after the SECOND level of nesting, since I'm hiding the first level.

    Do you have any advice for how to do this? If not, I'll bang my head and eventually crack it, but I figured I'd share my progress and see if you can solve this easily.

    PS: This required some relatively minor changes to FGTextEditor, FGTextBuffer, and a tiny change to FGParser (optionally force it to treat a file as c# regardless of extension. Since I dont actually care about the files for these, I'm loading in .txt files so it doesnt trigger a compile whenever it changes, and telling your editors / parser to treat it as a c# file). I got this going in all of one night ... so yeah ... ultimately you should be able to build this in with some thought if you want to. I'd imagine the ability to use this in custom editors is another nice marketing bullet point. In the mean time, I plan on rolling it myself to use in our suite of editors :D.
     
    Last edited: Nov 6, 2019
    Flipbookee likes this.
  46. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    I have another question about generics not working in some cases, sorry. This one is a good bit higher priority, as not only do I not get syntax help, but its drawing errors where there shouldnt be. It doesn't seem to be related to my custom code editors. Please note that this all works fine in Visual Studios for many months, so the code isnt the issue.

    I created SerializedList<T> which just inherits from List<T>. Any idea why generics are recognized in a List<T>, but not in my class which inherits from it?

    Example:
    List<string> test = new List<string>(); // I can access test[0] properly.
    SerializedList<string> test = new SerializedList<string>(); //It doesn't recognize whats shoved into test[0].

    Below you can see the SerializedList class. Note the error squigglies ... It can find all the necessary classes, so why does it say unknown symbol when I roll over test2[0].Id?

    code_editor_generics.PNG

    Also, just a fun note: The top left editor is SI3 plugged into my own custom editor for testing. I wrapped it up into a reuseable SITextArea class, so its super easy to use for me now. I'm going to end up replacing all the code boxes like the one its pointing to.

    This is _super_ powerful, and surprisingly easy to modify for what I need, as well as a great job on letting us easily customize the styling. I really don't have enough good things to say about this!

    [Edit -- I cant get any class that inherits from List<T> to work right. I assume you are aware of this then, or that I hit a weird bug. For now, I just removed the error squigglies when that happens so I can ignore it, but would love a real fix if you have one!]
     
    Last edited: Nov 8, 2019
    Flipbookee likes this.
  47. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    I salute your courage! I understand what you're after and can't wait to see how far you can take this :)

    Yes, please share everything you do and don't hesitate to ask questions. I may not be able to help immediately, but I'll give my best to support your efforts.

    Yup, I know what you mean. I had the exact same thing to deal with in my attempt to add an immediate code window to Si3.

    Yeah, I was trying to use HideLine as well. It was something I did a long time ago for code folding that I didn't finish, but I still have that code shelved, so I'm going to check is there any more code in it you may find useful. Good that you found a way to prevent the user from changing the hidden lines. I don't think I got that far.

    I guess the easiest way to do that would be to hack the result returned by CalcAutoIndent, just delete the first tab character and leave the rest of the string...

    The proper way to handle auto-indent and also handle the problem with the first and last line is a bit more complex - I'd have to change the parser and code analysis code to allow them to work on code snippets. Currently, they only work with the content of a whole C# file. The parser, for example, starts parsing the code using the "compilationUnit" rule of the C# grammar, while in this case what we actually want is to start parsing the code snippet with the "statementList" grammar rule. In another use case, we may want to start with the "expression" rule, and so on, so this would be a very useful feature. It would, of course, solve the need for having hidden text.

    Cool, please send me the changes you had to do and I'll try to include them with the next update, so you won't have to redo the same changes in Si3 code after updating it. I'll have to check my shelve, I think I had something done to let the parser work with C# code not saved in a file.

    Good catch, I didn't know there's an issue with that! It used to work, so I must have broken something in the code that deals with generics (which by the way, is the most mind-bending code I had to write ever in my life!!!). I'll fix that.

    Thanks mate, and please share the reusable class with me when it's done! I'd include it with the asset if you don't mind that :)
     
  48. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    Just some more testing done on 2020.1 12

    The script inspector works with editing when you open a script in its own window.
    When you view a script in the inspector it does not allow editing, you can select but not modify.

    So the problem is related to unity messing with the inspector panel.
    Good thing I can still use script inspector to edit when I just let the scripts open its own windows.
     
    Last edited: Nov 9, 2019
    Flipbookee likes this.
  49. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    Sure, I'd love that. It would mean in couple of years when we upgrade our engine, I won't have to re-implement all of this again.

    The biggest gotcha I hit is that this has to read off of an actual TextAsset file. Which means I have to create a new file for every single "SITextArea". That's not a problem in-and-of itself, since creating files is quick -- but having to refresh the AssetDatabase is slow. I assume theres no easy way to change this from requiring TextAssets that are ScriptableObjects (thus, have a GUID which I see you use to find the asset path), to just using System.IO to load in the actual textfile without needing Unity to recognize those files. If that were doable, this would become trivial to solve, even if you still needed it to be based on files, since this could just save the files OUTSIDE of the Assets folder, which would not trigger any additional wait times by Unity. I already do that for almost all of my editors c# for the same reason (I manually trigger when to copy them back into a data folder in the game, which lets us control when we get a compile ... while for SITextArea I solved the compile issue by saving them out as .txt files, its roughly the same issue). However, I assume thats a pipe dream ...

    I've gotten around this to _some_ extent in two different ways.

    The first way I handled it was to delay AssetDatabase.Refresh with EditorApplication.delayCall, that way I can make a single call that will refresh every textarea that was created that frame. This solve the issue of having multiple calls in a row for an editor with multiple SITextAreas.

    However, I still found that too obnoxious for our editors, as it meant every time I created a new textbox it automatically froze my ide for a few seconds. Switching between different dialogs, adding new prompts/responses to a dialog, etc, would all get this freeze, which is not a nice way to work. What I ended up doing for our personal use, and this is where you may want to think about if there's a better solution for your user-base in general, is:

    A) If the file already exists with the proper text, I just use it as-is and show the SITextArea
    si_text_area_c#B.PNG

    B) If the file does not exist, or does not contain the proper text (requiring a refresh), I show my old textarea with a C# button to the right, which when clicked, manually creates/updates the file and calls AssetDatabase.Refresh() so SITextArea will then be shown. Note that thisis my semi-skinned default textarea I already had thats used if AssetDatabase.Refresh would be required, so it looks very similar to using ScriptInspector3.
    si_text_area_c#A.PNG

    C) I prep my editors, where I run through _all_ the scripts, create/update any files as necessary, and then load the resource ONCE. That way, any pre-existing scripts will automatically use SITextArea, so I'm only left with B as something that happens for _newly created_ snippets, until the editor reloads or a manually refresh. However, it becomes a trade-off of where to do this ... if there are too many scripts it becomes an annoyingly long wait time here (ie: Dialogs have SO many scripts, that I do it when opening a dialog, as opposed to when I open the editor itself, since doing this to ALL dialogs at once is too many updates).

    This process is already built as static methods on SITextArea, so I just have to make a call to SITextArea.QueueFile() as I find scripts that need to update, and SITextArea.CreateFiles() when ready.
    sitextarea_prep.PNG

    Besides for that gotcha, this is working wonderfully. However, if you have any better ideas to make that a bit smoother, please tell me! This is annoying enough that I almost thought I wouldn't get past it, until I came up with the default texteditor solution. So I'm not thrilled about it ... its just the lesser of two evils, between not having a proper code IDE at all, or dealing with the AssetDatabase.Refresh times somewhere.

    Once this is used in production, I'll happily share what I have. I have a SITextArea wrapper class, and all my changes in FGTextEditor only occur if new booleans are set to true, so nothing I did affects the way ScriptInspector normally works. Because I already had a semi-skinned code textarea, I'm using that, but SITextArea could easily have the logic to show a regular EditorGUILayout.TextArea() if not ready to be used yet. If you don't like that solution as being built into SI3, I'd love any feedback if you have more insight into how to gracefully handle this! Obviously, I'd prefer not to have to use an actual file ... but looking at your code, it seems to all be based on using real files, so I don't expect that to become a solution.
     
    Last edited: Nov 10, 2019
    Flipbookee likes this.
  50. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    That's so funny. I actually need this behavior, and was very happy when I saw it was the default, haha. I don't want anyone else in our company to accidently change our codebase, so I _need_ edit to be locked when selecting a file with the inspector.

    Only editing when a file is opened in a SI3 window is a pre-req for using it in my projects. Thus ... if it gets "fixed", please make an option for this in preferences!!
     
    Flipbookee likes this.