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

Utilities Script Inspector 3

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

  1. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    @Bendixsa, supporting string interpolation syntax isn’t a simple change that anyone could add to Si3 parser, but I know it’s annoying and it will be supported with the first next update. The update was supposed to happen 10 days ago, but unfortunately, it isn’t ready yet. It also includes full support for async and await, the ?. operator, and (hopefully) expression-bodied members.
     
  2. Bendixsa

    Bendixsa

    Joined:
    Sep 25, 2013
    Posts:
    5
    REALLY!! Oh wow man that is EXCELLENT news! I don't mind waiting. Knowing that it's coming is great! Yeah I noticed the ?. operator was also not recognized.

    Thank you very much for this good news and thank you for your work it is really a wonderful addition to unity
    I look forward to your update take your time!
    Best Regards!
     
    Flipbookee and Lars-Steenhoff like this.
  3. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    121
    Just purchased the asset, and I just want to post about async await that unknown symbol. I hope it gets fixed asap because half of my project is async await UniTask.
     
    r137 and Flipbookee like this.
  4. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Oh, thanks for mentioning UniTask! Looks like a great source of test cases for me :)
     
    r137 and restush96 like this.
  5. r137

    r137

    Joined:
    Mar 12, 2018
    Posts:
    43
    Great plugin!

    +1 for async await / UniTask support.
     
    Flipbookee likes this.
  6. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    I got Script Inspector 3 as part of Unity's recent bundle deal. I didn't really know what I had until I tried it today. Wow. As others have said, this should obviously be part of the Unity editor. It completes the application IMHO. I really hope you're making good money off of this, @Flipbookee.

    In my first explorations there are two things I noticed. First, I like to know what column the caret is in. I try to keep my code lines relatively short (which is difficult in C#!) so having a reference as to what column I'm on helps. Alternatively, having a vertical line that I can set to my preferred line width would help a lot. Or both! :)

    Second is a slight bug (aside from a couple of others that I see you're handling already). When you type a line that extends past the width of the current editor window a horizontal scrollbar appears, which is expected (though I'd like the option to turn that off). The problem occurs when I reduce the line size to fit the window width. The horizontal scrollbar still indicates line overflow, even though the line is now shorter than the window width. Worse, this survives a close/open of the script. It's a small thing which would be hidden by a setting to turn off horizontal scrollbars.

    Thank you for Script Inspector and keep up the excellent work!
     
    Flipbookee and Lars-Steenhoff like this.
  7. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    Script Inspector 3 also doesn't seem to understand "auto" properties that are initialized.

    upload_2020-11-14_22-31-30.png
     
    Flipbookee likes this.
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Thanks @zigguratt! :)

    Vertical line(s) at a specified column(s) is something I wanted to add for a longer time, just I always forget to do that even though it's a very simple thing to do... I'll put a note somewhere.

    The horizontal scrollbar disappears if you turn the word-wrap on. There's an option for that in the gear menu in the toolbar. I can easily add an option to hide the horizontal scrollbar as well (and you'll be the only one using it, as far as I know ;)). Yes, the scrollbar remembers its range even if you shorten the "offending" line and that's one of the optimizations in Si3 for handling ridiculously long files. I guess I can handle that a bit differently to fix that while keeping the same performance - I'll think about that.

    I know about the auto property initializers, I can fix that easily in the next update. The current version only supports C# up to version 4.0, while the next version is going to add support for the most commonly used features of C# up to version 7.3.
     
  9. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    That's excellent! Thank you for the response. I'm really enjoying having my code editor built into Unity. As far as the horizontal scrollbar issue goes, I wouldn't want you to remove any optimizations. This has to remain the fastest Unity editor out there. I'd be more than happy being able to hide both scrollbars. I'm a VIM guy from way back so I tend to do everything with the keyboard. As a result I have no use for scrollbars. For me they just distract visually.

    Again, thank you for the response and I look forward to these small changes.
     
    Flipbookee likes this.
  10. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    I want to use si3 as my default script editor.
    Do I have to import SI3 for each new Project, or is it a way to make that happen automatically each time I start a new project from Unity Hub?
     
    Flipbookee likes this.
  11. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    Until SI3 is bought out by Unity and gets built into the editor you'll have to keep importing it into new projects.
     
    Flipbookee likes this.
  12. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    One more small addition for future releases:
    using static
    . Admittedly, I'm on Unity 2020.1, so I'm not sure when support for this was added. There is at least one reference to it in the Unity Docs:

    using static Unity.Mathematics.math
     
    Flipbookee likes this.
  13. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    I've started using
    using static
    quite extensively, so my code is now riddled with squiggly red lines:

    upload_2020-11-18_7-11-55.png

    I'll have to stop using SI for a bit, I think. I can't tell the real errors from the unsupported syntax errors. I'll keep monitoring this thread and come back for another try after some updates. Thanks again for your hard work, @Flipbookee.
     
    Flipbookee likes this.
  14. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Can I change windows shortcuts for SI3?
     
    Flipbookee likes this.
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Yeah, kind of - by editing the source code. What exactly would you like to change? Maybe I can do that for you?
     
  16. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    Hey, i purchased this plugin and just after importing it there were 3 Errors on Unity 2019.1.1f1 :

    Assets\Plugins\Editor\ScriptInspector3\Scripts\FGTextEditor.cs(1854,21): error CS1061: 'VisualElement' does not contain a definition for 'Query' and no accessible extension method 'Query' accepting a first argument of type 'VisualElement' could be found (are you missing a using directive or an assembly reference?)

    Assets\Plugins\Editor\ScriptInspector3\Scripts\FGTextEditor.cs(1858,41): error CS1061: 'VisualElement' does not contain a definition for 'Query' and no accessible extension method 'Query' accepting a first argument of type 'VisualElement' could be found (are you missing a using directive or an assembly reference?)

    Assets\Plugins\Editor\ScriptInspector3\Scripts\FGTextEditor.cs(1858,99): error CS0246: The type or namespace name 'ScrollView' could not be found (are you missing a using directive or an assembly reference?)

    What can i do? Thanks !
     
    Flipbookee likes this.
  17. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    @Da-Luk, do you have to use that version of Unity? I found Si3 doesn't work in Unity 2019.1 because I broke something while fixing it to work in Unity 2019.2, but no one has complained because, I guess, no one is using 2019.1... Unity recommends using 2019.4, the so-called LTS releases as those are supposed to be the most stable and most feature-complete versions.

    But if you have to stay on 2019.1, I can try to fix that again. Although, you should better upgrade to at least the latest Unity 2019.1.x... Let me know :)
     
  18. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    alt+t to hide SI3. It's hard to reach and I sometimes have to use this shortcut two times to hide it. I would love an option to change it.
     
    Flipbookee likes this.
  19. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    i'm upgrading to 2019.4 LTS i hope there will be no conflicts with other assets but thank you for the information ;)
     
    Flipbookee likes this.
  20. Bendixsa

    Bendixsa

    Joined:
    Sep 25, 2013
    Posts:
    5
    Hey Flipbookee,

    Do you announce here when you drop a new Si3 Release or is there
    a more official channel to keep an eye on for when updates drop?

    Only asking so I don't miss it as I'm really looking forward to the next versions
    new language support.

    Cheers!
     
    Flipbookee likes this.
  21. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Yes, I post here and in the other thread in the Asset Store forum.

    I've done the support for ?. operator, nameof(), string interpolation, but there's still some work left to finish async/await, which is quite a complex change, and to support auto-property initializers and expression-bodied methods, which are not that complicated. I was really hoping it would be simpler to add all that, like simple enough to finish with that last weekend, but no, it wasn't that easy, so I hope now it will be done next weekend. The static usings is another feature I wanted to add, but I didn't have a chance to start with that yet, and it may be a little more complex, so I'll keep that as a stretch goal.
     
  22. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    I see... Which shortcut would you prefer?

    The need to press the shortcut twice is because the first press moves the focus to the floating Si3 tabs if the focus wasn't there already. The second press hides them.
     
  23. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,851
    Say @Flipbookee, what are the chances we can get support for C# string interpolation? Or at least not have it identified as an error?



    I'm using this more and more lately, and it's a bummer to see what looks like errors all over my code.

    EDIT: Oops, I see you mentioned this just this morning, two posts up. You're either a mind-reader or you have a time machine. In either case I look forward to the next update!
     
    Last edited: Nov 23, 2020
    Flipbookee likes this.
  24. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    Here is what happens with autocompletion when I enter R +i+Enter

    As you can see, as I enter R+i, RigidBody is selected in the popup, but when I hit the Enter Key the auto completion is just abandoned, and a new line is entered. Is this correct behaviour, or is something not working as it should?

    If I however enter R +i+ArrowKeyDown+Enter, then RigidBody is made yellow and then it autocompletes. There should not be a need for ArrowKeyDown since Si3 already guessed that I was after RigidBody.

    If I use the Tab key, that is when I enter R+i+Tab, it does autocomplete.

    I am using Unity 2019.4 on MacOS 10.13.6

    Thanks for any help
     
    Last edited: Nov 23, 2020
    Flipbookee likes this.
  25. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    @bobueland, that's because you've disabled the "Auto-Complete aggressively" option. It was a @JoeStrout's idea and it only accepts completions with the Tab key. If you press the up or down arrow, the selection in the autocomplete list will change its color to tell it has switched to "aggressive" mode temporarily, which means it will accept the selected entry from the list on tab, enter, space, or one of these characters:
    { } [ ] ( ) . , : ; + - * / % & | ^ ! ~ = < > ? @ # ' " \
    as defined in the FGListPopup.cs at line 821. You'll also see there that only the Tab key would accept the selected entry when it isn't autocompleting aggressively, so you can add the Enter key there if you wish.

    IIRC, the non-aggressive mode was added for those who mostly type everything without relying much on autocompletion, so this mode lets them type code without worrying that autocompletion may change anything unless that's explicitly requested with the Tab key or with the up/down arrow keys. If you are not one of those, I'd suggest you try the default aggressive mode. It is very unlikely that thaggressive mode would disappoint you, dispate of its scary sounding name.
     
    JoeStrout likes this.
  26. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    @Flipbookee thanks, that explains it. I have a followup question. Among the { } [ ] ( ) . , : ; + - * / % & | ^ ! ~ = < > ? @ # ' " \ characters, I wonder why the hash symbol must be present. In C# the hash symbol # is used for preprocessor directives and would not follow anything chosen from the completion popup. Having the hash symbol prevents me from writing my own snippets for C# directives. For instance I want to create a snippet called #region that resolves to
    $ValidAsTypeDeclaration$
    #region $end$

    I know that I can name the snippet region but #region is nicer.

    Thanks again for very good answer.
     
    Flipbookee likes this.
  27. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    alt+x. Can you point me to the code part where I can change it myself, if I decide that I want to experiment with that shortcut.
     
    Flipbookee likes this.
  28. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Sure, that's super easy, just Find in Files (Shift+Ctr+F) for Alt+T and you'll find it in two places - two methods for the main menu item "Toggle Floating Tabs", one that executes the command and another that "validates" it. Just change the _&t part to _&x in both places, save and let Unity compile and reload the assemblies. :cool: It should work if the shortcut isn't already taken for something else.
     
    Gua likes this.
  29. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Hmm, that's a very good point! I'll remove the # symbol from that list, but I think that won't help to trigger a code snippet that starts with a # because the autocomplete only triggers while typing keywords and identifier symbols, i.e. tokens that start with a letter or underscore (or @). In fact, Si3 is missing a feature to autocomplete #region, #if, #define, and the similar.
     
  30. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Just bought this after years of grappling with visual editor and mono and it's such a relief to finally have a fast script editor! Is it possible to change the font and the font size?
     
    Flipbookee and Lars-Steenhoff like this.
  31. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    Zebbi and Flipbookee like this.
  32. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    @Zebbi, I'm sorry, I thought I posted my reply, but I don't see it here. :confused:

    Thanks @bobueland! That's exactly what I wanted to tell in my reply. :cool:
     
    Zebbi likes this.
  33. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Thanks! Can custom fonts be used? I tried copying them to `Assets\Plugins\Editor\ScriptInspector3\EditorResources\Fonts` and `Assets\Plugins\Editor\ScriptInspector3\EditorResources\Smooth Fonts` but they're not showing in the drop-down selector?
     
    Flipbookee likes this.
  34. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    @Zebbi
    To add a custom font you first have to get one from Internet, let's say Menlo-Regular.ttf. Navigate to ScriptInspector3/EditResources. You will see two folders there, one called Fonts and the other one called SmoothFonts. Drag you font file to both folders.
    Then navigate to ScriptInspector3/EditResources/Scripts, and open FGTextEditor.cs. Search for .ttf. You will find a list to which you can add your new font. Save twice and let Unity compile the script. It will take a while. That's it, you can now select your font.
    Note that many nice-looking fonts do not look the same inside Unity. The ones included with Si3 are very good, but you might find something else that looks better.
     
    seaeast2, Flipbookee and Zebbi like this.
  35. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Thanks! It would be really cool if SI3 had a preference for this that allowed for easier importing of fonts, and maybe even a presets option we could save and reuse for other projects!
     
    Flipbookee likes this.
  36. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    121
    @Flipbookee hello, any news about await/async UniTask?
     
    Flipbookee likes this.
  37. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    Hi Folks,

    For anybody interested I have made a tutorial for Script Inspector 3, which you can find on YouTube



    Cheers
     
    Last edited: Dec 3, 2020
  38. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    This is actually really interesting as I had similar questions myself about SI3!
     
    Flipbookee likes this.
  39. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    I hope to finish that today and release an update tomorrow with the other additions.
     
    restush96 likes this.
  40. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    121
    Flipbookee likes this.
  41. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    I think now I have async/await fully supported and working with the UniTask library. I had to support the new Generalized async return type introduced in C# 7.0 because UniTask completely relies on that feature. So that's cool and should let you use Si3 with UniTask. However, it won't work if you use UniTask with the Tuple type feature introduced also in C# 7.0 - supporting that needs some more work in Si3.
     
    restush96 and Lars-Steenhoff like this.
  42. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Hey, hey! Some good news for you, my friends:

    Script Inspector 3
    version 3.0.27

    is available in the Asset Store now
    New in version 3.0.27:
    - C# 5.0 to C# 7.3 support:
    * async and await contextual keywords
    * Null-conditional ?. operator
    * Expression-bodied methods, constructors, finalizers, properties, property getters and setters, indexers, indexer getters and setters, and event adders and removers
    * Initializers for auto-implemented properties
    * String interpolation
    * Fixed the nameof operator
    - New option to control auto-indenting in text assets - thanks @bobueland
    - Workaround for resizing autocomplete list - thanks @haywirephoenix
    - Fixed Cmd-Y binding on Mac for Go To Definition - thanks @Terko
    - Fixed unintended autocompletion on declaring local variable names starting with 'a', 'i', or 'n'
    - Fixed out of range exception on pinging non-existent line
    - Fixed warnings about "Window/Panel/1" not existing

    Enjoy! :cool:
     
    restush96, valarus, JBacal and 2 others like this.
  43. maephin

    maephin

    Joined:
    Oct 2, 2017
    Posts:
    2
    Hey @Flipbookee, hope all is well. I purchased SI3 a couple weeks back and I'm finally getting around to playing with it. I have a question, is there a way to prevent the editor from auto-indenting after I type the opening curly bracket? I'm still pretty new to coding, and right now this is the formatting that makes the most visual sense to my feeble brain:

    Code (CSharp):
    1. Function()
    2.     {
    3.     int val = 0;
    4.     }
    That is to say, the brackets begin on a new line and are in alignment with the code they're encapsulating. I's not a problem to simply hit enter+tab before typing that opening bracket, but SI3 will auto-indent the cursor so that it's one tab to right:

    Code (CSharp):
    1. Function()
    2.     {
    3.         int val = 0;
    4.     }
    I've fiddled with the in-Unity settings but I haven't found a way to change that. I think(?) a possible fix would be to automatically move the brackets to the cursor's "column" or vice versa. I've looked through the source code (particularly the textbuffer scripts) but I'm inexperienced and I don't want to break anything. Would you be able to point me to a place in the source code where I could possibly adjust this?

    Thanks for your time (and for SI3 in general!)
     
    Last edited: Dec 18, 2020
    Flipbookee likes this.
  44. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    Hey @ahp275, I think you found a bug. Thanks so much! Please fix it locally like this:
    1. Open FGTextEditor.cs (you can easily open any script with Alt+Shift+O on PC or Alt-Cmd-O on Mac).
    2. Go to line 8217 (Ctrl+G on PC or Cmd-G on Mac).
    3. Change this line:
    Code (CSharp):
    1. text += "\t";
    to this:
    Code (CSharp):
    1. if (SISettings.autoIndentCode)
    2.     text += "\t";
    4. Save and let Unity recompile Si3 and reload the assemblies.

    Then just disable the "Auto-indent code" option in Si3 Preferences -> Editor -> Tabs section, here:
    upload_2020-12-18_9-43-27.png

    And that's all - this should give you the desired behaviour and I'll make sure this fix is included with the next update (which might be as soon as this weekend).
     
    bobueland likes this.
  45. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    Is there a way to skip the highlight popups when I hover over the code in Si3?

    When I make tutorials, I use the cursor to point in my code and the highlights are in the way.

    popup.png
     
    Flipbookee likes this.
  46. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,754
    I see, yeah... The easy way to hide and disable them temporarily is to hold a key pressed, for example, Alt, or Shift, or Ctrl. But if that's not good enough, change this code in FGTextEditor.cs around line 1200:
    Code (CSharp):
    1.         else if (tokenTooltip == null && (hasCodeViewFocus || hasSearchBoxFocus))
    2.         {
    3.             if (mouseHoverToken != null && mouseHoverTime != default(System.DateTime) &&
    4.                 ((float) (frameTime - mouseHoverTime).TotalSeconds) > 0.25f)
    5.             {
    6.                 if (mouseHoverToken.parent != null && EditorWindow.mouseOverWindow == OwnerWindow)
    7.                 {
    8.  
    and make the last "if" condition always evaluate to false. :)

    Just for you, I'll add an option to do this from the Si3 Preferences. :cool:
     
    bobueland likes this.
  47. bobueland

    bobueland

    Joined:
    Sep 27, 2019
    Posts:
    19
    Thanks Flipbookee. Holding down the Alt key solves my immediate problem, although an option in Preferences would be nice :)

    Cheers
     
    Flipbookee likes this.
  48. maephin

    maephin

    Joined:
    Oct 2, 2017
    Posts:
    2
    Hey @Flipbookee, your solution worked - thank you so much! I'm really enjoying using SI3, especially with this fix. If it's included in the next update that'd be awesome. Thanks again for your support.
     
    Flipbookee likes this.
  49. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    Hi @Flipbookee, I just popped back in to check progress. I'm very glad to hear that
    using static
    is coming soon. If that's added and then you handle string interpolation as well, like
    $"{Application.dataPath}/Resources/Models"
    , I'll be able to try using SI3 again. Good work!
     
    Flipbookee likes this.
  50. zigguratt

    zigguratt

    Joined:
    Apr 15, 2020
    Posts:
    11
    Just checking out the latest version. I still get a lot of these with no further details.
    upload_2020-12-30_10-51-51.png
     
    Flipbookee likes this.