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,796
    Yes! That's easy, actually, and you can add that even now if you feel brave enough. Just open CsGrammar.cs in Si3 and find this piece of code:
    Code (csharp):
    1.  
    2.         parser.Add(new Rule("assignmentOperator",
    3.             new Lit("=") | "+=" | "-=" | "*=" | "/=" | "%=" | "&=" | "|=" | "^=" | "<<=" | new Seq(">", ">=")
    4.             ));
    5.  
    and replace it with this:
    Code (csharp):
    1.  
    2.         parser.Add(new Rule("assignmentOperator",
    3.             new Lit("=") | "+=" | "-=" | "*=" | "/=" | "%=" | "&=" | "|=" | "^=" | "<<=" | new Seq(">", ">=") | new Seq("??", "=")
    4.             ));
    5.  
    Then save that, let Unity compile it, and enjoy the magic of the moment - using Si3, you've edited its source code, and now it works slightly differently while you're still using it ;) How amazing is that? :cool:


    Hmm, how did you do this? I just tried and it works fine. You sure there were no other errors above this line?
     
  2. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Awesome thank you, after changing the Grammar it no longer has the red underlines for the rest of the script :)

    What about your code it also has some weird underlines, can that be fixed too?

    upload_2021-8-2_15-49-1.png
     
    Flipbookee likes this.
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Ah, so that happened within the same file? Yeah, that would explain it. Great, that’s fixed now :cool:
     
  4. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Yes and what about the script above from your CsGrammar, how do we fix that too?
     
    Flipbookee likes this.
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Ah yes, that was the other point you raised.

    That's a bit more complicated fix, so I'll have to fix that myself... I'll see if I can squeeze that in for this weekend's release. I just made the tuple types work, which took me a crazy long time to finish because it's an extensive feature of the C# language. I still have to polish and test that code a little bit, and if there's some spare time left I could try to fix this as well.

    The issue is in the semantic code analysis. Currently, my semantic analyzer doesn't resolve types of implicitly typed parameters of lambda expressions (the parameter s in my code) when a lambda expression is used as an argument for a constructor. It does that only when the lambda expression is used in arguments to invoke a regular method, but not in a constructor call, so it shouldn't be a too complicated fix, I believe.

    Thanks for pointing this issue out!
     
    zKici likes this.
  6. Cam_Fox

    Cam_Fox

    Joined:
    Nov 23, 2018
    Posts:
    29
    I'm getting this warning as well on Unity 2020.3.11f1 on every recompile. Is this a Unity problem, or something Script Inspector is doing? I've been ignoring it so far but it's polluting my console.

    Thanks!
     
    Flipbookee likes this.
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Thanks for reporting this! I wasn’t able to reproduce that error, so I’ll have to try that again. I don’t know who’s to blame for the error - it could be that Si3 does something that this version of Unity doesn’t like, while all previous versions were fine with that. If I manage to reproduce the error, I may be able to find a workaround for it.
     
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    @Cam_Fox, it looks like I still cannot reproduce the issue. I forgot to mention that this error might be also induced by some other plugin in your project or even your own scripts. Could you do me a favor? Import Si3 in a new empty project and see if you can make the error happen (add a new C# script to it and edit it to trigger the compiler). If possible, could you send me your Editor.log too?
     
  9. BjoernS

    BjoernS

    Joined:
    Nov 14, 2012
    Posts:
    5
    Dear Flipbookee,
    how can the default comments of the default unity functions be changed/removed?

    for this example:
    Code (CSharp):
    1. // Update is called every frame, if the MonoBehaviour is enabled.
    2. protected void Update()
    btw Si3 is great!! :D
     
    Flipbookee likes this.
  10. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Be pretty cool to pull up grepper code somehow within as well :)

    Maybe a shortcut or something to popup a window to search key terms and copy the code

    Here's a video for the VS addon:

     
    Flipbookee likes this.
  11. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Sorry for the delay in my responses here - I've been traveling these last few days...

    Hey @BjoernS, thanks for the support and your great review! :D

    If you ask how to change what the newly created script contains initially, that would be in the Unity install folder. You'd have to open the template script and modify it as you like.

    But if the question was about Si3 and how to make Si3 don't add those comments, then there's an option for that in Si3 Preferences (highlighted in the screenshot) - just untick it:
    upload_2021-9-4_8-48-42.png

    There's no option to modify the comments as they are hardcoded in Si3, but you can change Si3 code if you really need that. All magic methods are defined in GenerateUnityMagicMethod.cs as you may have noticed, but the comments for them are pulled from a Dictionary defined in Plugins/Editor/ScriptInspector3/Scripts/UnitySymbols.cs - just find the method name and edit the comment next to it. For that method, you'd find this line:
    Code (csharp):
    1.  
    2. { "MonoBehaviour.Update", "Update is called every frame, if the MonoBehaviour is enabled." },
    3.  
    Change the comment text, then save it and let Unity recompile Si3. But keep a copy of your changes and merge them with mine when you update Si3 ;)
     
  12. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Thanks @zKici! Grepper looks great and I think it's definitely worth integrating it with Si3. I'll see what I can do :)
     
  13. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Exciting! :) It'll speed up the process of coding for sure.
    Also still waiting on that fold option
     
    Flipbookee and Lars-Steenhoff like this.
  14. NeedsLoomis

    NeedsLoomis

    Joined:
    Mar 22, 2017
    Posts:
    57
    SI3 is unusable on my machine, (2020.3.18f1). The background is grey (regardless of which color theme I choose), making it pretty much unusable. I couldnt find anything searching this discussion, is this a known issue?

    Edit: Fix was provided, thanks!
     

    Attached Files:

    Last edited: Sep 12, 2021
    Flipbookee likes this.
  15. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Yes, it's a very rare issue that was only reported a couple of times. I couldn't repro that, but fortunately, the last Si3 user who reported that issue was kind enough to help me track the source of that issue and fix it in Si3! :) It's some weird bug in Unity that only happens on a combination of certain GPUs and Graphics settings in Unity. I can't fix the bug in Unity, but I found a workaround for Si3 that I'm quite confident is going to work for you as well.

    I'm sending you a copy of those fixes, so check your private conversations in a minute, try that, and please report back if that fixes the issue.
     
  16. NeedsLoomis

    NeedsLoomis

    Joined:
    Mar 22, 2017
    Posts:
    57
    Weird! Thanks for the incredibly fast reply and fix, everything is working great now!
     
    Flipbookee likes this.
  17. Cam_Fox

    Cam_Fox

    Joined:
    Nov 23, 2018
    Posts:
    29
    Thanks for your response and troubleshooting! I created two new unity projects 2020.3.11f1, one with the 3d template and the other with the 2d template. Imported script inspector and added/edited a script to trigger the recompile. No error!

    My other project has the following plugins:
    Blend Modes
    BG Database
    Collider View
    Dreamteck Splines
    Favorites Tab
    Fullscreen Editor
    Rewired
    Reiconed for Rewired
    Animancer
    Beebyte Obfuscator
    DevConsole
    Easy Save 3
    Monkey Commander
    Dialogue System for Unity
    RockTomate
    SoftMask
    TextMesh Pro
    Volumetric Audio
    MasterAudio
    AutoAsmdef
    Compiling Indicator
    As it's a production project I can't take those out!

    Removing the font and commenting out a string from the availableFonts array in Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs got rid of the error, which works for me. Maybe the error is caused by a slow asset reimport especially when opening or switching build targets for a plugin-laden unity project?

    Cheers!
     
    Flipbookee likes this.
  18. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Interesting... Thanks for all this info!

    I'll try to repro the error with some of those plugins. I don't have most of them, but I hope most of them are unrelated. It's more likely a single one that interferes...
     
  19. JBacal

    JBacal

    Joined:
    Jun 6, 2015
    Posts:
    59
    For some reason I am only able to tab (indent) 3 times and then the tab key stops adding indentations. How can I get more indents? Thanks.
     
    Flipbookee likes this.
  20. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Oh, sorry about that. It's a bug that affects some users only, and I have it fixed but not released yet.

    I'll send you that fix only, now.
     
  21. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Hi! I wonder why every time I use Unity Scripting Reference, it away go to Unity Manual but not API, is that unity problem?
     
    Flipbookee likes this.
  22. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    @victorkin11, I'm not sure I understand what's the issue. Can you explain what happens? I guess you're talking about accessing the Scripting Reference from Si3, right? Can you please show me an example - for what Unity symbol you want to access the API, what is the webpage that opens, and what webpage you expected to open instead? And also, what is your version of Unity.

    I did a quick check just now, to see if maybe the Unity website has changed somehow, but it all works fine, it seems...
     
  23. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Yes, inside Si3, right click in my script >Unity Scripting Reference . let said I want to check how to use SceneManager, it bring me to "https://docs.unity3d.com/Manual/ScriptReference&#x2F;SceneManagement.SceneManager.html.html" , but there no that webpage , it show "Sorry... that page seems to be missing!".
    My unity version is 2020.3.6f1.
     
    Flipbookee likes this.
  24. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Yeah, that's not a valid address. I don't know why your browser is going to that webpage when Si3 is telling it to open this webpage: http://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html o_O

    I checked this also with your exact version of Unity and it works fine for me... Can you try to open that webpage by clicking the link above?

    My best guess would be that clearing your browser cache and cookies for the unity3d.com domain is going to fix the issue. Can you please try that? :)
     
  25. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Sorry! not work even I clear the cashe & cookies, I wonder it is related with win10 language setting? uni-code or some mime type code etc. I don't know, &#x2F; look like is hex code "/".
    I also try to switch the default web browser to chrome, brave & firefox(old version), non of it work!
    or maybe some of my win 10 environment variables have problem?! but in unity help menu, script reference still working.
     
    Last edited: Dec 12, 2021
    Flipbookee likes this.
  26. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
  27. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Flipbookee likes this.
  28. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
  29. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Oh! my default is using local unity documentation, and it didn't work, when I turn it off, it work now!!
     
    Last edited: Dec 12, 2021
    Flipbookee likes this.
  30. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Thank! as least it work now.
     
    Flipbookee likes this.
  31. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Oh, I see what's going on now! You don't have the documentation installed locally, so Unity is trying to fix up the URL and convert it from a local file URL to an online URL for that same page, but it seems like that only work for links to pages in the Manual, and not for the Scripting Reference. So, I'll have to do something similar in Si3 - first check if local documentation is available, and if it isn't, open the online URL.

    Great! Thanks for helping me understand this issue, and I'm going to fix it quickly. :cool:
     
  32. abotrix

    abotrix

    Joined:
    Oct 21, 2015
    Posts:
    20
    I'm wondering if anyone else got this error. I recently had a layout error from pulling out an script inspector window out of unity to put on a second monitor and now when I open unity again script inspector doesn't show up anywhere. I have delete all unity folders in c:\Users\(user name)\AppData, delete library folder in project, reinstalled Unity (5.3.4f1), reinstalled Script Inspector, set external tools to ScriptInspector.asmdef but nothing works. Any help is appreciated.
     
    Flipbookee likes this.
  33. abotrix

    abotrix

    Joined:
    Oct 21, 2015
    Posts:
    20
    Never mine. I just figured out that if you have errors in your code and then some error occurs with Unity, it's best to make your project error free first before plugins get recognized.
     
    Flipbookee likes this.
  34. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Are you using Unity 5.3.4f1? Well yeah, there was that problem in older versions of Unity, but it got fixed at the time when .asmdef files were introduced.
     
    abotrix likes this.
  35. abotrix

    abotrix

    Joined:
    Oct 21, 2015
    Posts:
    20
    Thank you for responding! I'm currently stuck in Unity 5.3.4f1 until my game is done but it's good to know that when I use the latest version, I don't have to worry about that again!
     
    Flipbookee likes this.
  36. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Hey, my friends! Guess what's new today :)

    Script Inspector 3
    version 3.0.31
    is now available for download here

    It has some new features, many fixes, and improvements. Most notably:
    - IMPORTANT FIXES:
    * Fixed indentation with tab characters
    * Fixed potential infinite loop in the parser
    - C# 5.0-8.0 support:
    * Tuple types with explicitly and implicitly named fields, decomposition, and discard variables
    * Discard variables in assignments and out arguments
    * Pattern matching in "is expressions" for all 3 types: declaration, constant, and var patterns
    * Both null-conditional operators: ?. and ?[]
    * Null-coalescing assignment operator ??=
    * Binary literals
    * Digit separators
    - Added argument hints for constructors
    - Added "Search in Selection" option to Find in Files and Replace All - thanks @iloveloon
    - Added tooltips on SI tab titles showing file location
    - Improved tooltips to show the short syntax for Nullable types
    - Improved keyboard handling on Windows when the search field is focused
    - Saving CPU time and battery power by not blinking the caret when Unity Editor is not in focus
    - Fixed implicitly typed parameters of lambda expressions used as constructor arguments - thanks @zKici
    - Fixed reloading of externally modified files - thanks @JRDev
    - Fixed resolving constructor overloads
    - Fixed scope of foreach local variables
    - Fixed parsing of interpolated strings
    - Fixed lifted operators for nullable types
    - Fixed implicit conversion of types to an interface they implement
    - Fixed positioning of tooltips for C# code symbols
    - Fixed key bindings for quick find commands when arguments hint tooltip is open
    - Fixed syntax highlighting of the keyword "finally"
    - Fixed highlighting of matching braces
    - Fixed highlighting the line number of the current line
    - Fixed a rare issue with vertical positioning of text lines
    - Fixed a rare issue with the background color

    Please note that you can only download the new version of Si3 with Unity version 2018.4 or newer! After downloading it there, you can copy it into your other projects for older versions of Unity. This is because uploading for a version of Unity older than 2018.4 is not working currently, and I don't know is that a permanent new restriction or a temporary issue with the Asset Store or the Asset Store Tools.

    Thanks! Enjoy and please don't forget to post your feedback (here or as a new review).
     
  37. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Attention, please! There's a critical update waiting for you:

    Script Inspector 3
    version 3.0.32
    is now available for download here

    This is what's new in this release:
    - CRITICAL FIXES:
    * Fixed crash on resolving discard variable - thanks @michaellandonhatfield
    * Fixed crash on resolving named arguments
    - Supported double-click and right-click on log entries in SI Console logged with Full Stack Trace Logging
    - Updated look of search field and Code Navigation toolbar in Unity 2019.3+
    - Optimized keyboard input handling
    - Allowed editing .php and .py assets in the Inspector
    - Fixed resolving "foreach" variable type for non-interface based enumerable
    - Fixed auto-suggestions after the "new" keyword
    - Fixed auto-fix for adding a missing using directives and fully qualifying symbols
    - Fixed missing duplicates in call-stack frames for log entries on right-click in SI Console
    - Fixed tooltip on the first word-wrapped symbol
    - Fixed embedding in Properties windows

    It may not look like there were too many changes, but they are indeed critically important, so please update ASAP.

    Enjoy! :cool:
     
  38. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    Using 3.0.32

    Added a bunch of DLLs from a Github repo.
    Autocomplete does not appear to work with those DLLs.
    I tried putting them into "Plugins" and outside, no difference.

    Autocomplete works with VS when I open the scripts with that but doesn't when I use SI3.

    Do let me know if you have any suggestions or need more info on how to resolve this.
     
    Flipbookee likes this.
  39. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Thanks! No need for more info, I got that same issue this morning, so I know how to reproduce that. I also know what's causing it - it's because your scripts' assembly references those DLLs when it gets compiled, but those references are stripped out from the compiled assembly because no code is using them. Si3 relies on your scripts' assembly references to other assemblies, which doesn't work in this case. Once you add at least a single line of code that would prevent stripping out the reference (and compile that) Si3 would start working fine, but that's not ideal so I'll try to fix that now...
     
    ElevenGame and Kaen_SG like this.
  40. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    I think I have a fix for this issue now, and I think it would be worth also testing it with your exact case. Can you tell me what you did exactly?
     
  41. Kaen_SG

    Kaen_SG

    Joined:
    Apr 7, 2017
    Posts:
    206
    Copied DLLs into project assets folder.
    Create new script.
    In new script, type "using xxx" .. from the added DLLs.

    Doing this in external VS works fine.
     
    Flipbookee likes this.
  42. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    I’m pretty sure that’s going to work fine in Si3 too now, but I’ll still check… Expect a new release with the fix in a day or two :)
     
    Kaen_SG likes this.
  43. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Hey folks! Guess who's celebrating its 10th birthday today :)

    And on that occasion, here's a small present for you all:

    Script Inspector 3
    version 3.0.33
    is now available for download here

    This is what's new in this release:
    - IMPORTANT FIX: Fixed assembly references when they are stripped out
    - Fixed resolving certain generic extension method overloads
    - Fixed Unity Scripting API URL for event members

    Enjoy! :cool:
     
    abotrix and valarnur like this.
  44. abotrix

    abotrix

    Joined:
    Oct 21, 2015
    Posts:
    20
    Is there a way to have method separators?
     
    Flipbookee likes this.
  45. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Well, no because I didn't even know what's that until I google it now :p but yeah, it looks like an interesting feature, so I'll add that to my to-do list.
     
    abotrix likes this.
  46. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    TBH, I hate it when this thread gets quiet like this. No complaints, no bug reports, nothing... I knew fixing all the bugs was not a good idea, so I'll have to do something quickly to get their count back to the "normal" level :p
     
  47. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    folding code?
     
    abotrix, AthrunVLokiz and Flipbookee like this.
  48. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Yeah, that’s what I think too. New features are the best way to introduce some new bugs :rolleyes:

    I’m on it already…
     
  49. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Hi, what a wonderful tool! As I see it, this benefits more those that don't want to fire up the entire VS/Rider IDE or just have a small project/laptop.

    However, I just thought of something: I have a complex project, with close to a hundred Assembly Definitions, and in enough cases I'm waiting several seconds for the VS to reload, even though Unity's compiler finished quite fast.
    Any idea if this tool would be faster than that? i.e. will it be able to edit a script just after Unity's compiler finished, or does it have its own way of generating a C# solution? Or (worst for my case), does it completely rely on an external tool for C# solution generation?
     
    Flipbookee likes this.
  50. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    @thefallengamesstudio, I'm not sure, to be honest, but this sounds like an interesting test case. I'll send you a copy if you'd like to test that and I'd be very grateful if you report back the findings :)
     
    Jouni-Mannonen and xucian like this.