Search Unity

Utilities Script Inspector 3

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

  1. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Ohohoho, @rpgw thanks for your great feedback! :D

    I may have mixed Cmd-Arrow and Fn-Arrow shortcuts. I've noticed that too while testing something else and then I forgot to come back to that and fix it... It should be an easy fix...

    Unfortunately, Unity doesn't allow editor extensions to handle Cmd-Z on OS X or Ctrl+Z on Windows. However, with help of some magic and after two years spent trying everything I could think of, I've managed to handle Ctrl+Z on Windows only. Using a similar technique, I believe, this will be also possible on OS X, but it's a bit more difficult because the technique relies on some PInvoke calls to system libraries, for which I can't find any help on the internet for OS X, so I have to figure it out by trying different things... If anyone knows of an easy way how to declare and make system calls with PInvoke on OS X, please let me know!

    Hmm, what's that?

    Moving lines up and down is the shortcut I miss the most currently. I was planning to add that and to bind it to Alt+Up/Down arrows, which is same as in VS and MD, and it's been inherited as the default shortcut for that from Emacs AFAIK.

    Matching braces highlighting and eventually auto closing braces (and their friends) will come with the next update :D
     
    Breyer likes this.
  2. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    @rpgw FYI: Just as an aside, I use Karabiner to customize keys/shortcuts/redirects on my Mac:
    https://pqrs.org/osx/karabiner/
    For each shortcut you can include/exclude specific apps or specific input devices.

    For example, since I never use the Command and Option key on the right side of the keyboard, I used Karabiner to set up my MacBook Pro keyboard so that RIGHT_COMMAND key changes to HOME and RIGHT_OPTION key to END.

    And since the Apple Delete key acts like Windows Backspace key, and Apple is missing a key equivalent to Windows Delete key, I changed EJECT to be FN+EJECT, and changed EJECT to be like the DELETE key from Windows.
     
  3. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Hi, I just purchased SI2 and am trying out the Beta now. I notice that when I increase/decrease the font size via CMD +/-, the currently selected item within the Unity Hierarchy window gets moved to the beginning/end of the list of items hanging off it's parent there.

    CMD +/- seems the only way possible in OSX for me to change the font size of SI3 text. The Font setting is never enabled within SI3 for me, regardless of the theme. Not sure why that is but I wanted to make sure that you were aware of this side-affect.
     
  4. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Also, I'm using Favorites Tab to manage my scripts for SI3 now (using the Search:Scripts feature). When I select a new script from that tab, even though an SI3 tab already exists with that script's content, it always by default, selects it within the Project and pulls up it's inspector there, showing a duplicate of the script's content. Is there any way to disable that functionality? It's kind of distracting having script's content always pop up there. More importantly, it makes it necessary for me to reselect whatever object, within the hierarchy that was previously being inspected.
     
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @Jimww, I see, starting with Unity version 4.5 the Cmd-Minus/Equals shortcuts got assigned to its new GameObject -> Set as first/last sibling menu items, and Unity's unfortunate behaviour is that handling menu item shortcuts has higher priority than its focused windows... Can you try to change font size with Cmd-Shift-Plus/Minus instead? That works on Windows. Thanks for the info, I never noticed these newly introduced menu items until now.

    Other ways to change font size are Cmd-mouse wheel or if you have touchpad you can also do that with zoom in and zoom out gestures.

    I understand the issue while opening other scripts, it changes your selection regardless if you do that from the Project view or from the Favorites Tabs. If you have any other script already opened in SI view you can drag scripts from the Project view or from the Favorites Tabs on it and they will open without changing your selection. If you want to open a MonoBehaviour script assigned to a GameObject it might be easier for you to drag-drop that GameObject on any SI view and that will open the script also without changing the selection. :cool:

    I'll add an option to open any script right from inside the SI views as well... Thanks for your feedback!!! :)
     
  6. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @Jimww Did you say font settings is not enabled? You mean the font selection menu? I don't know what's that. Did you remove Si2 before importing Si3?
     
  7. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Yes, I removed SI2 before installing SI3.

    Disabled Font option (where I was hoping to find a size option):
    Screen Shot 2015-04-24 at 10.45.22 AM.png
     
  8. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Cmd-Shift +/-seems to work almost the same, like Cmd +/-
    If I could just set the font size once somewhere, that would probably be good enough.
     
  9. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @Jimww That's really crazy and I have no clue how could that happen?!? What version of Unity is that?

    Font size set using shortcuts will not reset, I think. Just make sure to set it twice, once in SI view and once from inside the inspector. These two are intentionally different to let you make the fonts a bit smaller in the inspector if you wish.
     
  10. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Unity 4.6.4f1 I don't believe that SI2 has this problem with the font menu option being disabled.
     
  11. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Okay, I found out what was disabling the font options submenu - which is a strange thing or most likely a bug in Unity on OS X.

    Changing line 1602 in FGTextEditor.cs from
    Code (csharp):
    1. codeViewPopupMenu.AddSeparator("Font/");
    to
    Code (csharp):
    1. codeViewPopupMenu.AddSeparator("Font//");
    for some reason fixes it! :eek:

    Seems like the single slash used to define the path where the separator will be placed on Windows works fine but on OS X it requires one extra slash (which then works on Windows as well)... So please make this change in Si3's source code and don't miss this magical opportunity to do edit Si3's code using Si3 itself and see the result right away and right there - in Si3 itself! :p

    Thanks @Jimww for this nice find! :)
     
  12. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Funny!

    I actually am curious about the types of things I might be able to do custom wise, within SI3. This should get me started, so Thanks!
     
    Flipbookee likes this.
  13. gg_michael

    gg_michael

    Joined:
    Sep 24, 2012
    Posts:
    73
    Hey @Flipbookee just wanted to say – keep up the good work! SI3 is a beast, it's made life so much nicer for me (and for may others I'm sure). Best asset store purchase I've ever made bar none. Love how quickly the beta is advancing too. I haven't opened MonoDevelop in ages and I couldn't be happier for that! :cool:
     
    Flipbookee likes this.
  14. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @mStep Thanks for your support! :D

    This is what keeps me awake these days:
    http://blogs.msdn.com/b/ericlippert...re-that-method-type-inference-terminates.aspx

    That's Eric Lippert explaining how type inference for implicitly typed lambda parameters works combined with method overloads resolution combined with type inference for type parameter of generic methods. Pretty cool stuff! :) and also a detailed description of the algorithm that can solve that, which is exactly what I was looking for :D
     
    gg_michael likes this.
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
  16. FireMutant

    FireMutant

    Joined:
    Sep 2, 2013
    Posts:
    49
    @Flipbookee,
    I messed around with it for a couple of hours. There's a lot to like about it and it loads MUCH FASTER than visual studio. IMO, you need to already have a visual studio solution file for it to be useful, because I think that is the only way you get intellisense. It doesn't have bookmarks and nobody seems to be able to get the debugger to work with it yet. The navigation is a little un-intuitive for me at first (there are not the normal Tabs at the top of the editor), but I guess you get used to it. Very programmer oriented with a lot of focus on keyboard commands. Also, the themes are very limited at the moment (Light, Dark, High Contrast). I think it definitely has potential over time though. My biggest concern about it would be that it tries to work with so many languages and may not be as useful for C#, but I am impressed with Microsoft's first release.
     
  17. Kadaiyen

    Kadaiyen

    Joined:
    Jul 16, 2012
    Posts:
    14
    @Flipbookee some additional feedback: I think it'd be wonderful to have the option to turn off the Si3 tab dynamic title resizing/positioning; it's neat, but I find it rather distracting. Also, an option to disable Si3 in the default inspector window would be nice - I find that it never makes enough sense to have my inspector wide enough for an Si3 view to be useful there, except if I were to use it for Si3, but then I'd have to change my layout - I feel much more productive simply delegating Si3 functionality to the spawned windows :)

    As for the new VS editor, at this time it's not very useful, and missing many important features; it's less useful than mono, even. :(

    A proper VS port to mac would be the end-all, and maybe that's the plan, but not yet ;)
     
  18. rpgw

    rpgw

    Joined:
    Jul 3, 2012
    Posts:
    47
    +1 to Kadaiyen's suggestions there.

    To an intermediate coder / scripter like me, the main appeal for SI3 (now that it has, and is getting many nice features) is the fact that it is inside Unity. It's a really big plus.
     
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Yes, I agree, @Kadaiyen's suggestions are great!

    Odds are low that Visual Studio Code will be able to debug Unity scripts, ever. That's because it requires Mono version 3.1 for that, while Unity runs on version 2.6... I still hope to get that working in Si3 :)

    As of porting VS to OS X, I guess that would be difficult, all the UI code will have to be rewritten. That's why VS Code runs as a fancy webpage inside Chromium, which makes it easy to port to all platforms. But then, it's a whole new project started from scratch, except the code analysis engine (Roslyn) which doesn't depend on UI and platform.

    Thank you all for sharing your opinion about Visual Studio Code! I wanted to know how much sense it makes for me to continue working on Si3 ;)
     
  20. FireMutant

    FireMutant

    Joined:
    Sep 2, 2013
    Posts:
    49
    @Flipbookee,
    Seriously, I wouldn't be worried about SI3 being "obsolete" because of some other editor. SI3 fills a very useful purpose that no external editor is going to replace. The convenience of SI3 cannot be over emphasized, especially now that it is gaining full editor capabilities. Even when I have VS open to do some major coding, I am constantly using SI3 to quickly reference other source files, or make changes in support code. Please don't stop. Just waiting for function arguments to make my life complete. ;)
     
  21. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    ^^ ditto ^^
     
    Flipbookee likes this.
  22. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    +1
     
    Flipbookee likes this.
  23. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
  24. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey Flipbookee,

    I am just planning to jump back into using Script Inspector. Just wondering if SI3 has something similar to Monodevelop's #region searching popup menu. I use this a lot to jump to different sections quickly especially for huge scripts.

    Thanks,
    jrDev
     
  25. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @jrDev Yes, as of now it has a "go to #region" button in the code navigation toolbar. :D

    I'll have to get all the other new features stable enough before I can send you an update though, and that would be the new beta or even a RC depending on how far I can get over the weekend.
     
  26. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Solarized


    Just saw this nice color theme on the web by chance, thought I might share it here..... ;)
    (and what's the status of that visual color theme editor......:D)


    Color theme editor idea.....

     

    Attached Files:

    Last edited: May 18, 2015
    Flipbookee and mcmorry like this.
  27. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    I know about Solarized, it looks nice! It was requested by someone already, and yeah, I was planning to add it. :)

    I can't see the last image about the color theme editor... The status is "deprioritized by more important stuff" :p but I'll get back to it. Now I have to get the Beta 5 ready by tomorrow and then try to get Si3 officially released by the end of this month. There are so many new features that I have to verify in Beta 5: parameter hints, auto-closing braces, full preprocessor support, improved generics, method overloads and type inference for lambda parameters, full semantic highlighting, resolver and autocompletions for member initializers, and many bugfixes.

    Edit: Oh, I see the image now! Looks nice :)
     
  28. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey Flipbookee,

    Sounds impressive. Can't wait to see the region jumping.

    Thanks,
    jrDev
     
  29. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @jrDev Right, I forgot to mention navigation to regions too :cool:

    I'll be sending you guys a copy once it passes all my tests. Stay tuned ;)
     
    FireMutant likes this.
  30. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    how testing going? i couldnt help myself eagerly waiting for next update ;)
     
  31. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Well, there were some issues and I fixed some of them. And there are still a few of them left, nothing serious though, just annoying glitches here and there... The extended semantic highlighting took me a lot of time, I had to go through all themes and update them.

    So, I broke my promise for last Monday obviously, but I have lots of free time over the weekends :) and I hope this one will be a very productive one! I'm not adding anything new, just fixing those features which are already there. Last time with Beta 4 I think I rushed it a bit too much, so I had to make 3 patches on top of that, and I don't want to make the same mistake :p
     
  32. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    oh i overlooked ur promise on monday release, i just wondering on status ;)
     
  33. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @Breyer yeah, I know. Knowing you guys care about this helps me as well :)

    So far I've fixed some of the issues. For example, matching brace highlighting was not working when cursor is placed on a completely empty line. Then I didn't like how matching braces were highlighted with an enclosing rectangle because its frame was overlapping with the cursor when it's just next to it, and it was also kind of too intrusive and distracting, so I changed it to a more subtle underlined brace which looks perfect now. But then that underline was getting hidden by the new parameter hints, so I had to move the popup by two pixels down. Which then it solved another issue - parameter hints don't hide squiggly underlines for errors anymore!

    Speaking of pixels and precision, I've found an issue with the mouse clicks being offsetted by 2 pixels which I also fixed. But then I realised that simple mouse clicks are expected to be "rounded" to the nearest position between two characters, while clicking (for a drag-drop) on a selection for example shouldn't use the rounded position. So I've changed that as well and now it all feels so perfect again :D

    Parameter hints are super-useful but sometimes they annoy me, so I hit Escape to hide them. But I didn't like that they would show up again as I continue typing. Then I changed that so they won't show up again until I finish writing arguments for that method call, and now it feels alright. :)

    There was an issue where keyboard focus was getting stolen after save by the new Navigate to Region toolbar button. Finding out the reason wasn't that easy, but fixing it was trivial.

    There are a few things still left, I have to make sure that while editing arguments in a multi-line argument list the popup doesn't hide any part of those lines... Some themes seem to not be fully updated... I still have to fix modifier keys on Mac for cursor navigation... Check again that it all works, etc... Will take one more full day at least...
     
    gg_michael likes this.
  34. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi, I've recently moved to Unity 5, and some shortcuts are not working anymore on OSX. Cmd+Enter is not opening the file outside, and Ctrl+S is not saving.
    But other shortcuts work fine as Cmd+D or Ctrl+Z
     
  35. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Save shortcut on OS X are Ctrl-Alt-S and Cmd-Alt-S, actually. I can't install Unity 5 on my Mac, unfortunately, so please let me know if that works. I can't also check why Cmd-Enter wouldn't work. Can you try that on an empty project or check all the menu items if there's anything assigned to this shortcut? Some other extension or even Unity itself may have taken the shortcut.
     
  36. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes true the saving shortcut works. But Cmd-Enter not, also in a new empty project with just the Si3 beta 4.3.
    If I use the context menu to open the file outside it works. So is only the shortcut. If you tell me where you intercept the shortcuts I could give a deeper look into it.
     
  37. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Oh cool, thanks! :) That might be inside FGTextEditor.ProcessEditorKeyboard but you could also check the menus if the shortcut is used for something else. If that's the case Unity will always give priority to the menu item and the keyboard event will not get to my function.
     
  38. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    So I tested on a new project and Cmd+Enter is still broken. I also checked in all the menus but I didn't find and shortcut already assigned. I'll try to see in the code if there could be something that could fix it.
     
    Flipbookee likes this.
  39. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Thanks, man! :)

    Looking at the code there's nothing suspicious. It's this piece of code which handles the keyboard inside ProcessEditorKeyboard:
    Code (csharp):
    1. else if (isActionKey && current.character == '\n' && !current.shift && !current.alt)
    2. {
    3.     if (EditorWindow.focusedWindow != null)
    4.         OpenAtCursor();
    5.     current.Use();
    6.     return;
    7. }
    It will be awesome if you get a chance to check are we getting there at all! :)
     
  40. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Script Inspector 3, Beta 5 just got released :cool:

    It took me longer than expected to polish everything, but I think that's more than worth because Si3 is now faster than ever as a result of a 2 and a half days of profiling and optimization session. There's still a lot of room for improvements, but I've taken care now of the most important parts of the code, so even though Si3 is still single threaded it runs very smoothly and it feels more responsive than ever.

    Other than that, it's important to know that cursor navigation keys were remapped on OS X to match the common Cmd/Ctrl/Fn+arrows behavior. Also you can now save your changes with Ctrl-S besides the old shortcuts (Cmd-Alt-S and Ctrl-Alt-S) and you can also quick-search for the word under the cursor or for selected text with Ctrl-Shift-Up/Down arrows in addition to the existing shortcut, Cmd-Shift-Up/Down.

    New features:
    - parameters hints
    - auto-closing braces, brackets, parentheses, and double-quotes
    - highlighting matching braces, brackets, and parentheses
    - parser recognizes and processes all preprocessor directives
    - navigation to #regions
    - improved resolving of method overloads
    - improved inference of generic type arguments for generic methods
    - auto-completion for member initializer lists
    - option in the Preferences to disable SI tab titles auto-expand on mouseover
    - everything else that I can't recall now :p

    I hope you'll enjoy the latest Si3 and I can't wait to see your feedback! :)
     
    Novack and I am da bawss like this.
  41. rpgw

    rpgw

    Joined:
    Jul 3, 2012
    Posts:
    47
    Fantastic. Very welcome improvements here!
    The last beta was already among my top assets already. :)

    Is semantic highlighting the colouring of variables to give each one a unique tint? I'm not seeing that in my scripts. (OSX Beta5 Unity 5.0.f4). I tried switching through the various themes and searching for an option for it but couldn't find anything.
     
    Flipbookee likes this.
  42. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Yes, I forgot to mention semantic highlighting in the list of new features. There are also 4 new color themes, Solarized and Visual Studio with VA X, both in Light & Dark variations.

    Yes, semantic highlighting is the colouring of the symbols based on their semantic information, so there can be different styles for methods, fields, properties, events, local variables, parameters, type parameters, value types, reference types, interfaces, delegate types, enums, enum members, shortcuts for the built-in types (such as int, string, etc...), and namespaces. Now see, not all themes use all of these features, many of them would just use one or two style only for all types, or for all member kinds. Often those two colors are only slightly different. The color values I've set in the themes are the original ones as they were defined by their authors, but we can change that. For now you'd have to tweak the color values inside the code where themes are defined, but we could also get a theme editor or theme importer that would just read the existing VS or MD themes. And to support importing of themes I had to extend Si3 to also support what VS or MD can do and make SI theme format match their theme formats, maybe not one to one but close enough.

    Semantic highlighting can go even deeper and allow specific styles for static members, or for non-inherited members, or for Unity API, for example... Let me know what you guys think would make sense and I'll try that :)
     
    Novack and I am da bawss like this.
  43. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    So I managed to fix it. There were 2 problems:
    1. In a previous switch(current.keyCode), at line 5345, after some commented lines, there is a return statement that was preventing to reach the code that you posted.
    2. in the code that you posted I added a check also for the character '\0'

    I'm sorry that I wasn't fast enough to include the fix in the Beta 5.
     
    Flipbookee likes this.
  44. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @mcmorry That's amazing! :D Thanks!!!

    Please send me the script, I'm not sure I understood what's the change :)
     
  45. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    *Imports SIB5*
    *Faints*
    *Gets up*

    This is fantastic Flipbookee! :O

    Thanks,
    jrDev
     
    Flipbookee likes this.
  46. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Flipbookee email sent :)
     
    Flipbookee likes this.
  47. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I don't know if you already fixed in Beta 5, but I saw that bit shifting operators are not recognized: << >>
     
  48. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Hmm, I haven't noticed that... I'll check!
     
  49. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey Flipbookee,

    Is there a find and replace option I am missing?

    Thanks,
    jrDev
     
  50. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Oh no, not yet. There will be soon though ;)