Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Utilities Script Inspector 3

Discussion in 'Tools In Progress' started by Flipbookee, Aug 10, 2013.

  1. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    Ah, it looks like string interpolation was added in the most recent update. It doesn't flag an error anymore. Love it! One thing you might want to consider in a future update is separating out the non-string content and allowing syntax highlighting on it. SI3 does this:

    upload_2020-12-30_16-40-34.png

    while Visual Studio 2019 does this (excepting the purple braces):

    upload_2020-12-30_16-39-53.png

    It's not hugely important but it makes it so that you can easily see the non-string parts of an interpolation.
     
    Novack, BillJackson and Flipbookee like this.
  2. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Right, I know about that and I'm working on improving that. The current version only recognizes the $ sign and prevents the error, and it won't work if there's a string literal in the interpolated expression. But it will work when I finish adding the proper support, and then syntax highlighting and even autocompletion inside { } will work... Did you know C# allows using other interpolated strings inside the { }? I didn't, but the C# specs mention that and it's explained how the parser is supposed to handle that by reparsing the expression recursively. So I'll have to do that like that as well. ¯\_(ツ)_/¯
     
    zigguratt likes this.
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I think I have that working now, but it was a huge task. Almost as complex as supporting extension methods... It has to go through some more testing before it gets released though, so it won't take too long, I hope. :cool:
     
    zigguratt likes this.
  4. BillJackson

    BillJackson

    Joined:
    Dec 13, 2016
    Posts:
    6
    I just bought Script Inspector 3 and love it. Spent my first full workday with it as my primary editor and it was very comfortable and speedy. Thank you for such a useful (and reasonably priced) tool. I do have 2 frustrations/feature requests:

    1. There doesn't seem to be support for C# named/optional arguments.
    upload_2021-1-6_23-12-50.png

    2. I'd like to see traversable placeholders in the snippets like in VSCode. For example, if I were to add the snippet
    "for each (${2:element} in ${1:array})", each time I hit TAB it would select the placeholders in ascending order (array -> element), allowing me to overwrite each.

    With these two behaviors my transition will be seamless. Thanks in advance for contemplating them.
     
    Last edited: Jan 7, 2021
    Flipbookee likes this.
  5. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    Your hard work isn't going unnoticed, @Flipbookee. I appreciate how difficult this is, being a coder myself. You're essentially reproducing a lot of what something like Visual Studio can do, but within the confines of Unity. I originally got SI3 with a very inexpensive Unity bundle. The entire thing cost me less than what you were charging for SI3 alone at the time. When you've advanced SI3 to a point where I can use it full time I'll re-buy SI3 at full price. It's not much, but I'd like to show my appreciation for your responsiveness and your hard work.
     
    Novack and Flipbookee like this.
  6. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    No, I did not know that!
     
    Flipbookee likes this.
  7. JBacal

    JBacal

    Joined:
    Jun 6, 2015
    Posts:
    59
    Excellent tool! But is there a way to auto-implement Interfaces? Thanks.
     
    Flipbookee likes this.
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    No, sorry, currently no, but it's planned to be added.
     
  9. skiwee

    skiwee

    Joined:
    May 30, 2020
    Posts:
    32
    Imported Si3 for the first time but its not showing up in windows and I don't know how to get it working.
    I'm not sure if its a bug or a Unity bug.
    Working on 2019.4.16
    Empty project and no error messages.
     
    Flipbookee likes this.
  10. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I just checked and it works fine for me. So, I'm not sure what that might be... ¯\_(ツ)_/¯

    Is this the first time you're using Si3? Did you try restarting Unity? Maybe try reimporting the folder Assets/Plugins/Editor/ScriptInspector3/

    If none of that helps, then I'm out of ideas for now, but send me the Editor.log and maybe I can see there what's wrong.
     
  11. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,458
    Screenshot 2021-02-15 at 18.22.36.png

    I like to request a new feature

    Find and replace in current script ( right click in window, and see here as extra option )

    The window find and replace in files does not stay on top and many time I just want to find and replace a variable in an open script.

    Thanks
     
    Flipbookee likes this.
  12. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Using
    =
    in
    if()
    statements doesn't flag an error, is this intended?

    if (GameObject = null)

    doesn't flag any errors, but it obviously doesn't work :p
     
    Flipbookee likes this.
  13. launemax

    launemax

    Joined:
    Feb 14, 2013
    Posts:
    16
    Hy. Thanks for this awesome Asset! Really like it :)

    Found a Bug in the Validation Check.

    If you nest Methods inside Methods then the Code is marked as invalid. I know its bad coding, but the Compiler accepts it and its valid Code.

    nested_methods_issue.PNG

    Kind regards,
    launemax
     
  14. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Thanks @launemax! :cool:

    Yes, local functions introduced in C# 7.0 are not yet supported in Si3, but I have them on my to-do list...
     
    launemax likes this.
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Well, intended is not the right word, but yes, it is how it works because Si3 doesn't flag all the possible errors. There are almost 1200 possible errors and more than 200 warnings in C#, and Si3 supports a small subset of those.

    All the errors that affect autocompletion are detected and flagged, because otherwise autocompletion wouldn't work or it would offer wrong suggestions. Si3 detects all the syntax errors and only some semantic errors.

    In your example, the error is about attempting to assign a value to a type, which is not allowed in C#. It would be fine if
    GameObject
    was a local variable, for example, as using
    =
    in
    if
    is not an error - it would compile fine, although it might not be what we really wanted to do. I'll try to add a warning about that.
     
  16. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    492
    @Flipbookee Script3 frequently freezes the editor when I need to scroll horizontally or vertically...I need to close Unity with the task manager and open again. I can't use your software like this.

    upload_2021-3-20_17-10-45.png
     
    Flipbookee likes this.
  17. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Oh, that’s weird. What version of Unity is that?

    I’ll send you a copy of the just about to be released new version of Si3. Please try it and let me know whether that fixes the issue.
     
  18. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    492
    Unity 2020.1.17f1. The problem wasn't happening at first. I'm not sure it started when I started to write really long one-liners, or when I started to use reflection. Either way, I started to scroll a lot horizontally and vertically, and it started to freeze every time. I had to stop using it.
     
    Flipbookee likes this.
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I see... Was that a .cs script or something else?
     
  20. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    492
    .cs script
     
    Flipbookee likes this.
  21. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Hey, hey! There's a present for you waiting to be picked up ;)

    Script Inspector 3
    version 3.0.28

    has just been released on the Asset Store
    ...and this is what you'll find in it:
    - C# 5.0-7.3 support:
    * using static directive
    * "in" parameters
    * expression-bodied operators
    * "when" in catch statements
    * pattern matching in switch statements
    * ref returns
    * local ref variables
    * ref assignments
    * conditional ref expressions
    * ref structs
    - Fixed flickering autocomplete list - thanks @Ksanone & @magnox7
    - Fixed compile errors in Unity 2019.1 - thanks @BradZoob
    - Fixed parsing explicit implementation of indexers in generic interfaces - thanks @qiwulun
    - Fixed "word stops" on non-ASCII letters - thanks @zeiksz
    - Fixed auto-indent when it's disabled - thanks @ahp275
    - Fixed tokenizing preprocessor directive argument - thanks @Sarinen
    - Fixed invalid argument exception on right-click - thanks @Sarinen
    - Fixed an index out of bounds exception
    - Fixed unnecessary delay when typing the first character
    - Fixed Monospaced Font button in SI Console

    And while you're there, please consider doing me a tiny favor - a nice review is going to mean the world to me :)

    Enjoy! :cool:
     
  22. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    172
    Really great work. I just picked up Script Inspector 3 in the sale to try it out and help support. It's really fast, much faster than Visual Studio. And staying in the Unity Editor while coding is a really interesting feeling. The core IDE experience is all there, and I love how lightweight it is.

    I can't wait to see it keep developing! The only thing stopping me from using it personally is lack of vim keybindings. But I know that's a very niche use case.
     
    Flipbookee likes this.
  23. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Thanks so much, @sameng! :)

    Vim keybindings has been requested several times and I have that feature on my to-do list, but it isn't very high for now. There are things I have to finish before that - currently trying to complete C# support for versions up to 7.3, then finish the Rename refactoring, then improve auto-indent and implement auto-formatting feature. Also, to fix a couple of bugs along the way, of which displaying correctly Chinese, Korean, and Japanese text is a harder one but has to be done.
     
    sameng likes this.
  24. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I finally finished adding proper support for interpolated string, all with highlighting and auto-completion inside the braces. I had to do some changes deep in the core of the tokenizer to support nesting interpolated strings, which took me quite some time to do, but I'm so happy it works perfectly now!

    This should be released early next week. :cool:
     
  25. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Hiya friends! Guess what's new? :)

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

    And this is what's new in it:
    • C# 5.0-7.3 support:
      • interpolated strings with syntax highlighting and autocomplete
      • inline out variable declarations
    • Full support for Chinese, Japanese, and Korean characters
    • Workaround for Unity's buggy positioning of the composition popup window
    • New code snippets: "prop" and "propg" - thanks @RGAMESR
    • Updated Visual Studio Dark color theme to match VS 2019
    • Improved resolving of method overloads
    • Reduced recursion depth for C# semantic analysis
    • Fixed semantic analysis of void delegate types
    I hope you'll enjoy this free update. :cool:
     
    RGAMESR, docsavage, crafTDev and 6 others like this.
  26. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    437
    Not sure if this is an issue or not (with new update)
    Unity 2020.3.6f1


    [Error] The asset at Assets/Plugins/Editor/ScriptInspector3/EditorResources/Smooth Fonts/Inconsolata.otf has been scheduled for reimport during the Refresh loop and Loading of it has been attempted.
    Doing this can lead to the AssetDatabase returning two versions of the same asset.
    Please ensure that code which attempts to reimport this asset does not run while the editor is Refreshing.
    You can do so by checking the value of EditorApplication.isUpdating
     
    Flipbookee likes this.
  27. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,818
    The gift that keeps on giving! So awesome!

    Thanks,
    jrDev
     
    Flipbookee likes this.
  28. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    100
    Thank you for keeping this project alive.

    I gave SI a little mention on the EXR github (hope you dont mind) since they're exploring adding a code editor to use in VR.

    Do you think its possible for SI to show an indicator at the current point of execution in play mode? It would be a really nice feature.
     
    Jouni-Mannonen and Flipbookee like this.
  29. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,818
    Hey,

    Having some issues in Unity 2021 with the sizing of tabs changing again when I hide/show. Also, the Console does not jump to anything when double-clicking errors or warnings.

    Edit: Also, this has been a small gripe for me, but SI refreshes and compiles sometimes after Unity comes back into focus, why is that? This made me lose quite a few changes I didn't save or save into memory.

    Thanks,
    jrDev
     
    Last edited: May 26, 2021
    Flipbookee likes this.
  30. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Ah, they changed that again? Damn, I'll fix that...

    Yup, I noticed that a few days ago and I fixed it for the next release (which should happen very soon). You can apply the same fix locally - insert this code in FGConsole.cs at line 362:
    Code (CSharp):
    1. file = file.Replace('\\', '/');
    No, Si3 doesn't do that. Unity does that on receiving focus - it checks if any script (or any other type of asset) has changed and reimports them which for scripts means to recompile them. So, I guess you've made changes to some scripts outside of Unity.

    Si3 is supposed to give a warning if Unity reimports a script with unsaved changes in Si3, asking whether to keep your version of the script or to replace its content with the reimported script. Did that not happen?
     
  31. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,818
    Hello,

    I don’t get any warnings. It just refreshes all the time.

    I’ll add that temp console fix until you update!

    Thanks,
    jrDev
     
    Flipbookee likes this.
  32. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I see, I'll check that...
     
  33. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Hey @jrDev, I can't repro the issue. I tried in Unity 2021.1.7 on Windows... What do you use?

    I tried several different scenarios and I always get the prompt to keep my changes or to reload the externally modified script and if the script wasn't modified I don't lose my changes, or if I my changes were saved it auto-reloads the externally modified script. Can you help me identify the steps to repro the issue?
     
  34. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Attention - Critical Update!


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

    This is what's new in it:
    • CRITICAL FIX: Fixed autocompletion for C# 4
    • C# 5.0-7.3 support:
      • Throw expressions
      • Default literal expressions
      • Fixed scope of inline declared out variables
      • Fixed autocomplete for "var" after "out"
      • Fixed resolving type of implicitly typed out variables in arguments of a generic method call
    • Fixed positioning of IME composition window in the Inspector of Unity 2019+
    • Fixed warning in Unity 2021+ about obsolete API
    • Fixed opening log entries in SI Console in Unity 2021+
    • Fixed positioning of Si3 floating windows in Unity 2019.4+ - thanks @jrDev
    • Fixed custom property drawer for UnityEvents to find its target set to a static member
    • Fixed resolving type of integer literals
    • Optimized resolving concrete generic types

    Not many new features, mostly bug fixes, but there wasn't much time for anything more than this since the last update.

    Happy coding! :cool:
     
    Last edited: May 30, 2021
    crafTDev likes this.
  35. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I’ve found a bug in calculating the width of tab characters for which I have a fix ready, but it isn’t ready for going live on the Asset Store yet. It should be ready very soon, but if you encounter the bug (it appears as the tabs characters stop indenting at certain indent depth, which depends on the selected font and font size) please let me know and help me test the fix before the release.
     
  36. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,818
    Hello,

    I'm using Mac.

    Thanks,
    jrDev
     
    Flipbookee likes this.
  37. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I see, right, I can repro the issue on Mac. Trying to find out now what has changed...
     
  38. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    @jrDev, could you please help me test a potential fix for this? Change line 489 in FGTextBuffer.cs from this:
    Code (csharp):
    1.         needsReload = needsReload || !justSavedNow;
    to this:
    Code (csharp):
    1.         needsReload = needsReload && !justSavedNow;
    I think that was a long-standing bug, but I don't know how it went unnoticed for so long, so please let me know whether it helps or if it breaks anything... Thanks so much!
     
    crafTDev likes this.
  39. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,818
    Hey,

    That seems to have fixed it now.

    Thanks,
    jrDev
     
    Flipbookee likes this.
  40. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Awesome, thanks!
     
  41. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    I've been working on adding support for C# typle types, and despite all the progress I made so far, this feature needs a little work before it gets ready for a release.

    It's a great and fascinating feature, but quite complicated to support... Did you know you can nest tuples in other tuples? Even when deconstructing them like this:
    Code (csharp):
    1.  
    2. var (someInteger, (someOtherInteger, someFloat), someString) = (42, (0, 5f), "Hello");
    3.  
    Well, I didn't, so my first attempt to support this failed. And now the second attempt is more promising, but not ready yet.

    Even more, this is all valid C# code:
    Code (csharp):
    1.  
    2. static class IntegerDeconstructExtensions
    3. {
    4.     static internal void Deconstruct(this int self, out string s, out int i, out float f)
    5.     {
    6.         s = self.ToString();
    7.         i = self + 1;
    8.         f = self;
    9.     }
    10. }
    11.  
    12. class Test
    13. {
    14.     void MyTest()
    15.     {
    16.         var (aString, (anotherString, anInteger, aFloat), anotherFloat) = 42;
    17.         // After that:
    18.         //   aString is "42"
    19.         //   anotherString is "43"
    20.         //   anInteger is 44
    21.         //   aFloat is 43f
    22.         //   anotherFloat is 42f
    23.     }
    24. }
    25.  
    It's going to take another week, I guess...
     
  42. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    437
    Hello just wondering how come the expand on mouse-over in si3 tabs titles is grayed out, i'd like to enable that...
     
    Flipbookee likes this.
  43. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    @zKici, that option is enabled and it works in Unity up to version 2018.2 because the tab titles changed in Unity 2018.3 to something completely different - they don't squeeze anymore to fit all in the tabs row but stay expanded all the time and we have to scroll them left and right to find what we want now :(

    Until I find a similar solution for that, I'd suggest you try the SI tabs switching keyboard shortcuts - Ctrl+Tab and Shift+Ctrl+Tab on Windows and Alt-Tab and Shift-Alt-Tab on macOS. It works same as in Visual Studio - if you keep holding the Ctrl key (Alt on macOS) the tabs list stays on screen and you can press more Tab and Shift+Tab, or use the arrow keys, or select a tab from the list with the mouse to switch to the desired SI tab.

    Also, don't forget that the Alt+Left/Right arrow keys let you navigate through the "history" of the cursor locations even across multiple files, which is often easier than Ctrl+Tab and are more powerful than the same commands in Visual Studio as with these in Si3 you can move the cursor back in the "past", do some editing there, and then return the cursor in the "future". You can't do that in VS, which makes these commands much less useful in it, but in Si3 these shortcuts rock and work perfectly!!!

    And if that's not enough, use the Alt+Shift+O (Alt-Cmd-O on macOS) to find quickly any script by just typing a part of its name, or Ctrl+Shift+O (Shift-Cmd-O on macOS) to open a script you know it's in the same folder as the current one.

    Now I know none of that is same as the super-cool "expand on mouse over" option, but I hope you didn't know some of these shortcuts and this post helps a little bit for now :)

    EDIT: I forgot to mention that on Windows, the 4th and the 5th mouse buttons are also bound to cursor history navigation commands, same as in Visual Studio or in a web browser.
     
  44. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    437
    I did not know that thanks :)
    Does improve the process a lil bit. Hopefully there's a new solution to that Mouse over tab like before in the future, and cant wait for the grouping code option though i'd say that would be number one improvement
     
    Flipbookee likes this.
  45. dbordzo

    dbordzo

    Joined:
    Aug 14, 2015
    Posts:
    34
    I think that code snippets doesn't work correctly.
    For an example you've got
    Foreach snippet, when you press tab, it just give you


    Code (CSharp):
    1. foreach (var item in collection)
    2. {
    3.             // Here is cursor
    4. }
    It should be on item, to change it name after pressing tab it should go to collection, and then go inside loop
     
    Flipbookee likes this.
  46. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Yes, the implementation of the code snippets in Si3 is very basic for now. It was done as a side bonus feature that wasn’t even requested. Since then, a few people asked if it could be improved to work like in other IDEs, so that’s now on my to-do list, just I can’t say when it might be done. There are other higher priority tasks to be finished first, like adding support for the few remaining features of the newer C# versions that now Unity supports, which is then needed for implementing the rename refactoring feature, and then next will be automated code formatting and code folding. Only after finishing all that I may be able to work on any other improvements.

    Sorry if that wasn’t the answer you were hoping to get, but I have to build the priorities in a way that they would please as many users as soon as possible, so I’m not able to fix this issue right now. Still, I hope that makes sense, and trust me please - sticking to these priorities is in your best interest as well even if it doesn’t sound like that at first sight.
     
  47. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Due to popular demand, the Asset Store put Si3 back on sale again, so there’s another chance to save 50% if anyone missed it during Week 2. :cool:
     
  48. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    437
    Finish your code so I can fold mine :)
     
    Flipbookee likes this.
  49. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,751
    Haha! That's brilliant :D
     
  50. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    437
    Will SI support ??= in the next update?

    The code still works but it shows the red underlines
    upload_2021-8-1_22-27-52.png

    Thanks
     
    Flipbookee likes this.