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. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Oh okay, I'll check... Thanks man!
     
  2. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Flipbookee do you have any plan to create a UI to customize the shortcuts, or at least a scriptableobject stored outside of Si3 (so that will not be lost after updating Si3).

    Or even a extendable class tha will redefine the default shortcuts (Full Inspector has a similar system to expose some settings. In case you need I can enter more in detail how is implemented.)
     
    Flipbookee likes this.
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @mcmorry, yes, but you know, there's always something more important than that ;)... A good start might be the window that lists all the shortcuts which was requested a long time ago. The same window might be used for customizing, I guess.

    I think I'll have to store all customization in EditorPrefs, otherwise different projects may have different settings and you also don't want to override the settings of your teammates. Also your own custom shortcuts should not be shared between Mac and PC, so classes and ScriptableObject's are not an option. :p Still, I'd be interested to know how is that solved in Full Inspector.

    P.S.: I was going to ask you what's the point of using Full Inspector, but I see it has 31 review and all of them are 5 stars, which is quite impressive!!!
     
    mcmorry likes this.
  4. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    mcmorry likes this.
  5. inventor2010

    inventor2010

    Joined:
    Nov 3, 2010
    Posts:
    124
    Hey @Flipbookee, found one! :(

    Came up while I was working on making a generic extension method.

    Code (CSharp):
    1. ArgumentOutOfRangeException: startIndex + length > this.length
    2. Parameter name: length
    3. System.String.Substring (Int32 startIndex, Int32 length) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/String.cs:356)
    4. FGTextBuffer.GetTextRange (.CaretPos from, .CaretPos to) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextBuffer.cs:954)
    5. FGTextBuffer.RegisterUndoText (System.String actionType, .CaretPos from, .CaretPos to, System.String text) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextBuffer.cs:1245)
    6. FGTextBuffer.DeleteText (.CaretPos fromPos, .CaretPos toPos) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextBuffer.cs:1339)
    7. ScriptInspector.FGTextEditor.DoGUI (Boolean enableGUI) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:3200)
    8. ScriptInspector.FGTextEditor.DoGUIWithAutocomplete (Boolean enableGUI) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:2761)
    9. ScriptInspector.FGTextEditor.OnWindowGUI (UnityEditor.EditorWindow window, UnityEngine.RectOffset margins) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:2610)
    10. ScriptInspector.FGCodeWindow.OnGUI () (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGCodeWindow.cs:1054)
    11. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    12. UnityEditor.EditorWindow:SendEvent(Event)
    13. ScriptInspector.FGListPopup:Update() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGListPopup.cs:494)
    14. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    15.  
    Thanks for all excellent work as usual! :D

    Oh, and I'm on version 3.0.5 with Unity 4.3.2f1. (On my old computer :p )
     
    Flipbookee likes this.
  6. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    The EditorPrefs could be a solution, but only if it's possible to export/import the setting to a json or xml file so that I can restore or share the settings.

    I have to say that I can't even think how to work in Unity without Full Inspector. I use intensively SmartableObjects with complex data structures. For example Dictionaries or List containing interface types or enums, and with FI I can easily inspect, add and edit all the data inside. I can also easily add comments and formatting to the data in the inspector without the need of and editor class or even add button to execute methods to export/import data or to test some features.

    The way FI stores the settings is to automatically create (after the import of the package) a new folder called FullInspector2_Generated where it stores some classes. They get updated based on some settings inside a window.
    Also, through reflection it locates and instantiate a settings class that I added and that extends a class from FI. In this way is possible to override some methods to return custom settings.

    Anyway if you will have the opportunity to try it I'm sure you will like it. Is very advanced and well organized code.
     
    Flipbookee likes this.
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @mcmorry I think I'm going to try the free demo of Full Inspector. Thanks man! :)

    @inventor2010 Nice catch! :p I'll check that code...
     
  8. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    @Flipbookee, I got another feature creep for you... hotkey for maximize code window and show the other SI code tabs while maximized.
     
    Flipbookee likes this.
  9. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    There is a shortcut to toggle maximized when it's docked to the main Unity window but then the other tabs will be not shown, and there is no shortcut to toggle maximized when it's in a floating tab but you can maximize it with the mouse and the other tabs will be still there... So these are two halfs of that feature half-working in two different cases :p The other two halfs can be added but those are not trivial and require some conjuring through Reflection. I actually wanted to have these for some longer time, but there's always something more important... I'll check the floating tabs first, I think that's easier.
     
  10. schplurg

    schplurg

    Joined:
    Mar 21, 2009
    Posts:
    208
    Bug?

    Sometimes ctrl + shift + F won't open Find In Files, I've noticed it on several occasions, like right now :D

    Mac Mavericks

    ETA
    A unity restart fixes it (and since Unity crashes several times a day I suppose it's not such a big deal ;) )
     
  11. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @schplurg, did you have the keyboard focus on a Si3 tab? If yes, the shortcut should always work. If it didn't work while the focus was on a Si3 tab then it might be a bug - I'll check!
     
  12. schplurg

    schplurg

    Joined:
    Mar 21, 2009
    Posts:
    208
    I had some code selected before hitting the shortcut combo.

    I had previously closed the Find tab after using it earlier, so maybe that'll help figure it out. I'm not sure if that was the case every time.
     
    Flipbookee likes this.
  13. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
  14. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Quick progress info: Partial types are fully supported now! :D This may need some testing and optimization before the release ;) but it should be ready this weekend.

    I have to put that on hold temporarily - gotta prepare a video for the Unity Awards ceremony, showing all the features...
     
    rpgw and Novack like this.
  15. schplurg

    schplurg

    Joined:
    Mar 21, 2009
    Posts:
    208
    It happened again today while the Find tab was still open...just fyi. Save and restart Unity fixed it.

    I remember I had just done a Find All, then selected different text and hit the shortcut again - nada. Window never popped up again.
     
  16. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @schplurg I see... Thanks for the info!

    If it happens again could you please try to open it from the menu? Window -> Script Inspector 3 -> Find in Files...
     
  17. schplurg

    schplurg

    Joined:
    Mar 21, 2009
    Posts:
    208
    I see by your post that I must not be using the latest version. I'll update and do that.
     
    Flipbookee likes this.
  18. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    @Flipbookee The lastest one 3.0.5a still not fixed when I hit F12 to go to definition (reported above) and I can not live without it, I decided to have a look. Not really sure if this is the correct fix but it appears that it fixed for me ... At line 226, file FGFindInFiles.cs, which currently is

    Code (CSharp):
    1. while (w < words.Length)
    I changed to
    Code (CSharp):
    1. while (w < words.Length && l < lines.Length)
    Anyway, looking forward for your fix in the next update :) I did a wonderful job man ! :)
     
    Flipbookee and Novack like this.
  19. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Just thought up the #1 time saver feature... When you have a selected log line... and you're in one of the methods on the call stack... a context menu/shortcut to go up and and down in the call stack!!!
     
    mcmorry and Flipbookee like this.
  20. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @thienhaflash Yeah man, you reported that after the release :p... I hope to get 3.0.6 ready by tonight, if not then it will be almost ready ;)

    I've fixed something there but now looking at your fix I'm wondering is your fix maybe a better fix than mine? So I'll check that... Thanks!!!
     
  21. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Nice!!! :D Any suggestions for those shortcuts?
     
  22. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    something like: CTRL/CMD + L + down arrow (to go next) and CTRL/CMD + L + up arrow (to go previous)
    The "L" is for Log.
    I don't know if is possible to implement a two stage shortcut. I mean that the user doesn't have to press the down/up arrow together with CTRL/CMD + L, but that could release the L and then press the arrow (keep pressing the CTRL/CMD key).

    EDIT: CTRL/CMD + L is already used for "Go to line". So maybe + SHIFT :)
     
    Flipbookee likes this.
  23. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    How about ALT-UP/Down/Left/Right for actually moving the cursor NO MATTER WHAT popup is currently trying to help and CMD/CTRL+ALT+Up/Down for the call stack thing?
     
    Flipbookee likes this.
  24. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    I know you will get angry with me for this but BUMP unityscript autocompletion ! yahooo~!!!!!
     
    Flipbookee likes this.
  25. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
  26. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Flipbookee I just want to say thanks, this plugin is truly awesome. I haven't read all this thread, and most likely some of the stuff has been said before, but can you give me a date for some of the following features:

    1. Format document - high priority
    2. Refactor classes, methods, variables, etc.
    3. Automatic add the needed libraries for classes (I type the class "Text" - and it appears "using UnityEngine.UI;" on top of the file )
    4. Generate code for overridden methods
    5. A list with all the shortcuts and options to change them

    Thanks again, I hope you're not too busy to implement them.
     
    Flipbookee likes this.
  27. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Flipbookee

    PS. I forgot something.
    6. quick open scripts- like you press Shift+Alt+o and you get a textfield and you type the name of the script with autocomplete and you open it like in Resharper
     
    Last edited: Sep 16, 2015
    Flipbookee likes this.
  28. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Hehe, guess what? With Si3 installed you can press Shift+Alt+O in Unity (anywhere in Unity, even without opening any Si3 window) and you'll get exactly that! :cool: Unless you're on a Mac, then that shortcut will be Alt-Cmd-O ;)

    Isn't that super-cool?
     
    Victor_Kallai likes this.
  29. schplurg

    schplurg

    Joined:
    Mar 21, 2009
    Posts:
    208
    I haven't had the mysterious "Find In Files window not opening" thing occur, but I notice one other thing...

    Usually when I select a bracket (or parenthesis but in this case it happens with brackets) I can scroll down and locate the corresponding underlined "closing" bracket, but it doesn't always work, a lot actually. Sometimes I have old code that is commented out that is in between - could brackets in that code be confusing it?

    If I open the document in Mono then it works fine, so I can compare side by side. If it's a small block of code then it works, but if there are nested brackets or longer code it does not. Latest version of Si3.
     
    Flipbookee likes this.
  30. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @schplurg Yes, there's a bug in 3.0.5 that breaks brackets highlighting in some cases. I've submitted that by mistake and it will be fixed in 3.0.6 which is almost ready for upload...

    There's also support for partial classes (and structs and interfaces) in 3.0.6, smarter magic methods that are now aware of an existing implementation of the method in a base class and handle that appropriately, and some other smaller improvements and fixes ;)
     
    Victor_Kallai likes this.
  31. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Flipbookee

    I found a bug, Si3 does not recognize extension methods, it shows an error on those methods: "unknown symbol" - even though Unity compiles it correctly.
    Eg of an extension method:
    public static void setPositionX(this Transform t, float newX)
    {
    t.position = new Vector3(newX, t.position.y, t.position.z);
    }
     
  32. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Hey @Victor_Kallai, thanks for reporting the issue! I just tried that very same example and it works fine for me :confused:

    Extension methods are fully supported, but they were added recently so it is possible that there are some bug somewhere in that code. It will be really great if you can help me reproduce the issue! Can you give me some more details? Which symbol exactly was marked as "unknown symbol"? What are the namespaces where the extension method is declared and where it is used? What is the exact line where it is used? Or if you could send me those two scripts with their relative paths in your project that would be even better... So let me know, seems like you've found an interesting case ;)
     
  33. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Flipbookee

    Yes, you are right, extension methods work everywhere, except in scripts which are in Editor folder. Really weird stuff :))
    And they show in autocomplete, but they get flagged as errors.
     
    Flipbookee likes this.
  34. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Okay, I'll check that but I still need more specific info if possible. It will help me a lot if you say what's the path of the script where the extension method is declared and where it's used. Then knowing the exact namespace relations between the two will also be useful, as well as public/protected/etc modifiers on classes and method declaration. Then the exact line where the method is invoked... If you don't mind just send me those two scripts only in a private message and I'll see everything I need to know. I don't have to be able to compile that, so I don't need your whole project ;)
     
    Last edited: Sep 17, 2015
  35. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Flipbookee likes this.
  36. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @Victor_Kallai Thanks man, that was an excellent find and I just fixed it - YAY! :D

    It should be released later today :cool:
     
  37. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Script Inspector 3 - version 3.0.6
    is available now on Asset Store :cool:

    What's new:
    - Partial classes, structs & interfaces are supported now
    - Magic methods respect implementation in a base class
    - Group by File & Keep Results options added to Find Results window
    - Bug fixes

    Enjoy!!! :D
     
  38. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Flipbookee I love the way and the speed you keep updating and expanding this product. I hope that you would consider to give higher priority to the problem of shortcuts. It's very stressful as it is now:

    The CMD+W to close a tab is now CMD+SHIFT+W, but on Windows is CTRL+W and CTRL+SHIFT+W close all tabs.
    CMD+Enter doesn't work. I remember that I did some tests with you to resolve it, but it was never integrated in you new versions, and I don't like to update your code every time that I update the plugin.

    Please, please, consider the shortcuts management as an important feature to don't postpone anymore. As it is now, it's very buggy, confusing and hidden. :confused:

    Also (I don't know if you already implemented), can you add a move up/down of the current line (or selected lines) with a shortcut (maybe with auto indentation too :p)?

    Thank you
     
    Flipbookee likes this.
  39. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @mcmorry Sure thing man! Shortcuts are now the highest priority! :)

    I'll check again the Cmd-Enter and your fix. Does that fix work for you? Unity 4.x works for me without any changes, and this is what confused me :-s

    Alt-Up/Down will also be added to move line(s) up and down. Auto-indent after move seems to be a natural addition to that... Let's see how is that going to go ;) it sounds easy to me.

    Note that in lack of move line shortcut you may want to enable the option to copy and cut the current line when nothing is selected. Than you just paste the line wherever you need it.

    In order to handle Cmd-W we may have to be limited to only get that using @inventor2010's plugin. I hope that's fine for you folks?
     
  40. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @Flipbookee Thank you very much! :)

    Yes the fix that we implemented was working on Unity 5 on OSX.
    It was enough to comment out a return inside this if:
    Code (CSharp):
    1. case KeyCode.Return:
    2. case KeyCode.KeypadEnter:
    3.     if (isActionKey && EditorWindow.focusedWindow != null)
    4.  
    I don't mind to use the plugin from @inventor2010
    I think he already told you that you can use it freely and integrate it inside SI3.
    Only Unity 4.x free user on OSX could suffer from this choice (unless you can keep some compatibility for them). I hope that most of the developer are moving to Unity 5.
     
    Flipbookee likes this.
  41. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Sorry I was wrong. I just tested and you should comment out all the code inside the if. Not just the return.
     
  42. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Yes, the rest is already commented out, only the return is still there. I just tried that on Windows and it works in both Unity 4 and 5... If someone can check that with Unity 4 on Mac that would be awesome! I didn't bring the MacBook with me on the way to Boston (currently I'm stuck at the airport in Iceland, connecting flight delayed :()
     
  43. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Mmm, Boston...

    Does your trip has anything to do with something like "Winners in all categories will be honored at the Unity Awards at Unite 2015 in Boston, MA, on Tuesday, September 22." ? :p
    Hope you get there in time my friend, any news about the delay?
    By the way, I voted for Si3 in both categories you where nominated, you deserve the award for sure...

    Good Luck and a Good Flight!
    Cheers,
    Franco
     
    Flipbookee likes this.
  44. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    Hehe yes, I'll be there tomorrow :) but I don't think Si3 has any chances to win. If I have to, I'd put my bets on Uber Standard Shaders ;) that one looks very pretty. :)

    What's your bet?
     
  45. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Think the Olympic thought...

    You're a winner already for getting nominated twice and being there...
    It's a privilage and a big honour, anything beyond that is a bonus...

    My bet is my wish...
    ;)

    Cheers!
     
    Flipbookee likes this.
  46. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    Bad news for today ... SI v3.0.6

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. FGTextBuffer.EndEdit () (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextBuffer.cs:1269)
    3. ScriptInspector.FGTextEditor.DoGUI (Boolean enableGUI) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:3175)
    4. ScriptInspector.FGTextEditor.DoGUIWithAutocomplete (Boolean enableGUI) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:2763)
    5. ScriptInspector.FGTextEditor.OnWindowGUI (UnityEditor.EditorWindow window, UnityEngine.RectOffset margins) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:2621)
    6. ScriptInspector.FGCodeWindow.OnGUI () (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGCodeWindow.cs:1061)
    7. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    8.  
     
    Flipbookee likes this.
  47. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I installed Unity 4 just for you :cool:
    CMD+Enter was already working just after the import of the package. Anyway I checked the code and this is how it looks just after importing:
    Code (CSharp):
    1.                 case KeyCode.Return:
    2.                 case KeyCode.KeypadEnter:
    3.                     if (isActionKey && EditorWindow.focusedWindow != null)
    4.                     {
    5.                         //current.Use();
    6.                         //OpenAtCursor();
    7.                         //EditorWindow.focusedWindow.SendEvent(EditorGUIUtility.CommandEvent("OpenAtCursor"));
    8.                         //GUIUtility.ExitGUI();
    9.                         return;
    10.                     }
    11.                     break;
    12.  
    Then I uncommented all the lines, as I did for Unity5, and on Unity4 CMT+Enter still works correctly without any warnings.
    The strange thing is that CMD+S doesn't work in Unity4. I had to use CTRL+S. I have Unity Pro, so I thought that the plugin from inventor2010 should also work here.
    I'll keep Unity 4 installed in case you need more tests.
     
    Fronne and Flipbookee like this.
  48. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,749
    @Fronne, yes! You're absolutely right. Thanks! :)

    @thienhaflash Thanks man! Looks like something new, I'll check...

    @mcmorry Cool! Thanks for testing that! :)

    I don't know about the Cmd-S, the plugin was working fine for me on Unity 4, although I had to use the 32 bit version he made at the end. I wonder now is that the only version of the plugin that works with Unity 4?
     
    Fronne likes this.
  49. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I just copied the MacKeyboarHook plugin in the editor folder near SI3 and restarted unity 4. I tried both 32 and 64 bit versions and nothing works. Should I do something more for Unity 4 to activate the bundle?
     
  50. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    There is a much needed filter to the Find in Files which is the already opened files... I often end up looking for something I saw a while back.
     
    Flipbookee likes this.