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. Dismiss Notice

Utilities Script Inspector 3

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

  1. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    Finally got a chance to load up the updates and review the changes... you've been very busy!

    A small inconsistency, for Dark Theme:



    Edit: ah, I see your code trying to work around a Unity bug (where they're trying to fix the spelling of a style). The FGConsole works where the FGTextEditor doesn't, because you're just extending the original Console.

    I made a couple small changes to my local copy to "uncrowd" the title bar, basically removing the Autofocus and Monospace controls which end up overlapping the other more useful things. If I weren't as lazy as I am, I would have seen about adding this as a preference setting myself.



    And lastly, both search bars seem a bit wide. I dunno if it makes sense (or is easy to implement) but they could shrink down to fit just a few characters when the text inside them is completely empty, freeing up room and not blocking as much. Otherwise, it tends to crowd and overlap.



    Awesome stuff, and long live ScriptInspector3!
     
    Last edited: Sep 11, 2023
    Lars-Steenhoff and Flipbookee like this.
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    Looks like flipping the workaround works. You were saying, "if the old style spelling exists, use it." Code below says, "if the new style spelling exists, use it." Apparently both style spellings exist while they're migrating over, but only the new one has the right values.

     
    Flipbookee likes this.
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Hey, my friends, check this out! :cool:

    Script Inspector 3
    version 3.1.4

    is available on the Asset Store

    This one is kind of a small update, mainly to address a tiny bug in inferring types of some implicitly typed parameters of lambda expression, with a few small improvements suggested in the last week or so.

    However, it also contains code that integrates Si3 with the Hot Reload plugin if it's installed in your Unity project. Please note that I'm not affiliated with the authors of Hot Reload, but I tried it and I think it's a good workflow improvement for myself, so that's why I decided to add support for it in Si3. They offer a free trial version if you'd like to try it as well, and if you do so, please let me know how it works with Si3 :)

    So anyway, here's the list of changes:
    - Hot Reload plugin support & integration
    - Added OnPreSaveCSharp callback to FGTextBuffer - thanks @halley
    - Added option in Si3 Preferences to swap Shift+Enter and Ctrl+Enter hotkeys - thanks @WanAmir
    - Hide Auto-Focus and Font toolbar buttons when the SI Console is not wide enough - thanks @halley
    - Shorter toolbar search box when it's empty - thanks @halley
    - Ping the edited asset by clicking the asset path in the toolbar - thanks @halley
    - Better workaround for misspelled toolbar search field GUI styles in Unity - thanks @halley
    - Fixed inferring type of some implicitly typed lambda expression parameters - thanks @GrassWhooper

    Enjoy coding with Si3, and please don't forget to review it if you like my work! :)
     
  4. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449

    I would love to get the dark search bar back from before, The new white one looks out of place.
    I'm reverting to a previous version until that search bar is no longer white :)
     
    Flipbookee likes this.
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    The white was unintentional. Just apply the changes shown in post #2052 to your copy of FGTextEditor.cs, or download the newest whole set of changes in 3.1.4.
     
    Flipbookee and Lars-Steenhoff like this.
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449
    It is version 3.1.4. that gives me the white search bar in the inspector.
    I'm not sure what to change in the script?


    Screenshot 2023-09-26 at 00.08.10.png
     
    Flipbookee likes this.
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449
    The older version looks like this much better.
    In the new one on the right side the search bar white and is also cut off.
    Maybe it was not updated or I have a mac with unity 2022.3.10 and that is somehow different?

    Screenshot 2023-09-26 at 00.10.31.png
     
    Flipbookee likes this.
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Ah, sorry about that - I should have checked the changes in more Unity versions. It worked just fine in those I checked...

    I checked again and this is what makes it work in all Unity versions (I didn't check all versions, but this is a much nicer workaround and it must work):
    upload_2023-9-27_9-2-38.png

    The only change I made is at line 15126 (in the latest Si3), from this:
    styles.toolbarSearchField = new GUIStyle(searchFieldStyle);
    to this:
    styles.toolbarSearchField = new GUIStyle("ToolbarSearchTextField");

    I hope that helps for now, and I'm planning another release this week with that fix and a few more improvements.
     
  9. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    Really happy with all the latest changes, I updated again and can ditch my FGConsole hacks for narrow windows.

    I have noticed an odd behaviour with breaking lines and adjusting indentation, though. Tab stops are 4, using only spaces, in case that matters. Unfortunately, I have not found a 100% reliably repeatable case. If I split code to wordwrap, e.g., inserting a newline before the second underscore:

    Code (CSharp):
    1. ....if (farthestIndex < nbStepHits)
    2. ....{
    3. ........_internalCharacterHits[farthestIndex] = _internalCharacterHits[nbStepHits];
    4. ....}
    the code will break as expected like this:

    Code (CSharp):
    1. ....if (farthestIndex < nbStepHits)
    2. ....{
    3. ........_internalCharacterHits[farthestIndex] =
    4. ........_internalCharacterHits[nbStepHits];
    5. ....}
    but if I then hit Tab to add one stop of indentation, it will sometimes insert 3 spaces instead of 4:

    Code (CSharp):
    1. ....if (farthestIndex < nbStepHits)
    2. ....{
    3. ........_internalCharacterHits[farthestIndex] =
    4. ..........._internalCharacterHits[nbStepHits];
    5. ....}
    Another Tab will add one space to bring it to the intended tabstop, but if I don't notice it, multiple lines of code that follow might end up misaligned and Shift+Tab will maintain the odd misalignment until I remove all indentations and tab it back.

    It seems like some files are more susceptible to this than others; if it happens once it will happen anywhere in that file or buffer, but other files with very similar code just never repeat the problem. I will keep trying to find a more concrete repeatable case.
     
    Flipbookee likes this.
  10. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @halley, that might be the weirdest bug so far ;) but thanks, I'll try to reproduce that.
     
  11. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Right, I found it! I fixed that and I think I'll release it this weekend with all the other fixes collected over the last three weeks.
     
    halley and Lars-Steenhoff like this.
  12. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    Glad you found that indent quirk.

    I am not sure what the new "Auto-Fold Regions" option does... I was hoping it might allow me to turn on/off the initial folded state of regions when I open new files. I'm an ancient fuddy-duddy who'd rather not have the regions all folded most of the time, but I know you young whipper-snappers would rather them all crinkled up by default until you poke them.
     
    Flipbookee and Lars-Steenhoff like this.
  13. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449
    Yes a toggle Fold all / Unfold all would be good to have
     
    Flipbookee likes this.
  14. AericGames

    AericGames

    Joined:
    Aug 15, 2023
    Posts:
    4
    I wasn't aware of this asset but it looks amazing, and you've obviously put a ton of work into it!
     
    Flipbookee likes this.
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Yes, it does exactly that, and I'm pretty sure about that because I just tested it. Just note that it also remembers the collapsed state across domain reloads, so the script is in its "initial" state only when its undo buffer is empty, and only then that option in Si3 Settings does get applied... However, the saved state doesn't survive restarting the Unity Editor, or forcing Unity to reimport the script (these two actions also clear the undo buffer).
     
  16. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Thanks @AericGames :rolleyes:

    Yeah, an awful lot of work actually, 11+ years so far, and there's still so much I want to do...
     
  17. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Right, I don't know why I haven't added that yet. I know I was trying to come up with a sensible keyboard shortcut for that, but nothing looked good enough. Any suggestions?
     
    Lars-Steenhoff likes this.
  18. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    I had tried the feature by turning that flag off, and then opening files with #region that I had never opened previously... and they were folded upon opening. But now I am trying the same thing and it works as expected. Gremlins.
     
    Flipbookee likes this.
  19. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449
    Shift + F ?
    And it could cycle between : custom folded / all unfolded / all folded

    I would also make a toggle button somewhere
     
    Flipbookee likes this.
  20. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    I like the cycling idea, but Shift+F won't work, that's reserved for typing a capital F ;), Ctrl+F for focusing the search field, and Shift+Ctrl+F for Find in Files. And any combination of Alt and F opens the File main menu, so I'll have to find something else
     
  21. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,449
    You can add the function to a menu bar item and then users can configure a shortcut key for themselves
     
    Flipbookee likes this.