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.

Utilities Script Inspector 3

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

  1. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Well no, Si3 doesn't compile the scripts. That's still done by Unity's built-in compiler. So no, I cannot change that as it isn't related to Si3 at all. :)

    There's one part of that which actually I can improve - after a successful compile, Unity reloads the old and the newly compiled assemblies, and right after that Si3 needs to reinitialize itself. That reinitialization used to take a couple of seconds on my laptop (when running on battery in energy-saving mode) and I improved that a lot, so now it takes about half a second only. This improvement hasn't been released yet because I also started working on code folding, which turned out to be a huge change and I'm still working on that. I've made a lot of progress on the code folding feature though, so I hope to finish it very soon and then release all these improvements.
     
  2. Minzie

    Minzie

    Joined:
    Jul 26, 2019
    Posts:
    71
    Can you try to amend current script exist in your project? Don't create new script. It works fine if I create new script, but error occurs if include "using Cinemachine" namespace in any existing script.
    No, the project can't compile at all. The error keeps showing in console log there & I can't enter playmode.
    I've been trying to recreate this error in new project. But after my workaround, I can't find the errors anymore. What I've done: I uninstalled & reinstalled VS community 2022 in my laptop & SI3 from the package manager. Click "regenerate project files" & select the external script editor as VS 2022 in preferences-> external tools. At this time, error still there. So instead of amending the current script I have (any script), I create new script & copy all the current script to the new script. At this time, no more error when I use Cinemachine namespace. After closing Unity editor & restarting laptop several times, it seems no more error even if I amend current script to include Cinemachine namespace. I'm not sure why..
     
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Yeah, I tried both with a newly created script and with the existing ones, and it works. Although, once a script is created it becomes an existing script right away, so there is not much difference between the two. The only difference between those scripts I could think of might be the folder in which they exist, which could be significant in your case as that in Unity defines into which of the project's assemblies each script will be compiled, and different project assemblies would compile referencing a different set of other assemblies. Si3 takes that into account, same as the compiler, so both the compiler and Si3 would report errors for any code that tries to use a namespace defined in a non-referenced assembly. That's a bit too complicated for me to explain in a single post like this, but I'd recommend reading Unity Documentation on that topic and its subtopics from here: https://docs.unity3d.com/Manual/script-compilation.html

    Okay, then you have to fix the compile errors. Please read and understand the link to Unity Documentation about script compilation and assembly definitions I gave you above. If the script with compile errors is part of an assembly defined by an "assembly definition", you may have to manually add a reference to Cinemachine in that assembly definition.

    No, don't do that, it won't help. If there are compile errors in your script, you'd have to fix them. The compile errors won't fix magically on their own - you have to do that.

    Now I'm not sure, did the compile errors go away in your project or you couldn't reproduce the errors in the new project? If you still get compile errors, send me the Editor.log file and I'll try to help you.
     
  4. qmqz

    qmqz

    Joined:
    Jan 25, 2013
    Posts:
    17
    Hey, I'm not certain if I overlooked something, but is there a way to keep the opening brace on the same line? I've already tried the settings in Preferences, and even editing the code snippets, but it doesn't change anything. Any time I create a new class, it'll still use opening braces on new lines in start, update and the namespace.

    Also neither of the Magic Methods checkboxes change anything, as I still get comments for Start and Update.
    Unity 2021.3.12f1

    Thank you.
     
    Flipbookee likes this.
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Hey @qmqz, I guess you figured this out by now - here's the option that moves the opening brace to a new line that you prefer to turn off:

    upload_2022-11-17_10-43-19.png

    It's the last tickbox at the end, the highlighted one - just turn it off.

    And thank you so much for your awesome review :) and the feedback, which is always much appreciated and taken seriously.
     
  6. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    I just checked this too and it seems to work fine for me. Can you tell me more about what happens in your case?
     
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    A quick update about the Code Folding upcoming feature - this is where it stands right now:

    Si3-code folding.gif

    There is still some work left with that, but the most complicated changes are done now :)

    But it took me several months to get this working in Si3. It required a crazy amount of changes so far. The feature looks very innocent, but in fact, it's an evil one! Folded code changes everything in the code view - text layout and rendering, keyboard handling, mouse clicks, positioning of popups, rendering selections and other text highlights, word wrapping, and whatnot else... I almost regret starting work on this, but I'm proud of the progress :p
     
  8. ANFADEV

    ANFADEV

    Joined:
    May 27, 2016
    Posts:
    113
    Hi i noticed that when using Script inspector in a project using HDRP, .shadergraph assets are opened as text when double-clicked, instead of being opened by the shader graph editor

    The only workaround i found for this is to disable shader opening like this:
    upload_2022-12-10_20-16-23.png

    But this will disable opening other shader files,

    Is it possible to exclude .shadergraph files from the rest please? they're basically just serialized objects,
    upload_2022-12-10_20-18-20.png
    so no one would need to edit them by hand
     

    Attached Files:

    ClearRoseOfWar and Flipbookee like this.
  9. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Right, someone alerted me about that and I fixed it for the next release, so .shadergraph files will open in the shader graph editor.

    In the meantime, the easiest workaround is to hold down Ctrl on PC or Cmd on Mac while opening the file, which temporarily inverts the Si3 settings for whether to open a shader in Si3 or in Unity’s default editor, which in this case is the shader graph editor.
     
    ANFADEV likes this.
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,335
    I have a situation where need to look at a large script and refactor something, since there is no way to have two windows open of the same script, so I need to scroll up and down and find the place each time.
    Maybe there is a way you can make a merge / diff window that has the same script 2 times open?
     
    Flipbookee likes this.
  11. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    You can open the same script in as many windows as you want with this button:

    49B80DCF-2DD5-49D4-8ACD-936DFF3FC06F.jpeg

    And then put them side by side, if that’s what you mean?

    Although, I’d do that in a single window and use a lot of Alt+Left and Alt+Right arrow keys to move back and forth between the two (or more) distant locations. Those are the two buttons with arrows right below the one I highlighted above. Or the 4th and 5th mouse button - those two do the same :cool:
     
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,335
    Thank you thats what I needed, little did I know it was already right in front of me :)
     
    Flipbookee likes this.
  13. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,835
    Is there any way to have per-project Si3 preferences?

    I have just one project on a team that, contrary to all that is natural and holy, insists that we indent with spaces instead of tabs.

    But that means I have to remember to go to Preferences and toggle the "Insert Spaces on Tab" checkbox whenever I switch between this project and a sane one. And sometimes I forget.

    Is there any way to have a settings file in the project itself, which will override global preferences for this?
     
    Flipbookee likes this.
  14. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    @JoeStrout, I see what you mean - indenting with spaces must be a pain... But you know me, I wouldn't let a friend suffer like that for long ;)

    I think I will add "settings profiles" shared among all projects, and then let each project select its own profile. That would be a bit easier for me, but having files that override the setting would still be nice to have especially if they work for the containing folder and its subfolders.

    For now, I think you should change the prefix constant string at line 26 in my SISettings.cs for your odd project only:
    upload_2022-12-25_9-59-39.png

    Doing that would revert all Si3 settings to their default values only in that project, but then you could set them to anything you want and they won't interfere with your other projects. :)
     
    JoeStrout likes this.
  15. ClearRoseOfWar

    ClearRoseOfWar

    Joined:
    Sep 6, 2015
    Posts:
    87
    Really appreciate the work you put into this ide. Just wondering about a release date for collapsing.
     
    Flipbookee likes this.
  16. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Thanks @ClearRoseOfWar! :)

    I was going to reply "possibly the end of next week" when you posted that, but now, a few days later, I think that was too optimistic. I may have something ready for testing by the end of next week, but not ready for release yet. I know you're very keen to get the code folding feature, so I hope it'll be okay if I send you a copy to help me test that and shorten the time from then to the actual release date.
     
  17. The-Oddler

    The-Oddler

    Joined:
    Nov 26, 2010
    Posts:
    133
    Was just getting into Unity again a bit after many years, wanting to try out the new DOTS stuff, but I've since switched to Linux (NixOS) and was having trouble setting up VSCode properly, and then remembered this. Really happy this is still alive and well, which makes sense because it's a really cool tool!
     
  18. vith47

    vith47

    Joined:
    Dec 31, 2020
    Posts:
    1
    Hi, I need help, how can I do this using SI3? Thanks a lot! upload_2023-4-6_22-2-5.png
     
    Flipbookee likes this.
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Hi @vith47! You cannot do that currently, the implement interface feature is not implemented yet Si3. That’s on my to-do list, and it’s been there for too long, so let me see what I can do about this now and I’ll let you know.
     
    vith47 likes this.
  20. unity_A0HrN8vE0XQ8Gw

    unity_A0HrN8vE0XQ8Gw

    Joined:
    Sep 8, 2018
    Posts:
    4
    I really love SI3! I use it a ton. Really looking forward to code folding. Are you still chipping away at it? Any updates?

    Keep up the good work!
     
    Flipbookee likes this.
  21. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    425
    probably folded in a drawer somewhere, been at it for year(s)?
     
    Flipbookee likes this.
  22. unity_A0HrN8vE0XQ8Gw

    unity_A0HrN8vE0XQ8Gw

    Joined:
    Sep 8, 2018
    Posts:
    4
    He has a post from December where it looks functional (but he says it still needs work). So if he's found much time to work on it in the meantime it may be ready or nearly there.

    It's pretty impressive how long he's supported this. Just this thread is ten years old. And while he does go months with no updates here, he does consistently return. His last post was Thursday. I have a lot of Unity assets that have fallen into disrepair and are no longer functional. So I really appreciate his continued effort here. Especially considering there's really no other good options if you don't want to or can't use Visual Studio. I was using Notepad++ prior. The QOL of SI3 is so much nicer.

    While, it's possible that this feature is stuck in Neverland, I have faith! Sometimes slow and steady wins the race.
     
    Flipbookee and zKici like this.
  23. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,685
    Hehe - "folded in a drawer somewhere"? No man, I'm still working on it! :)

    I made a lot of progress recently and it doesn't look desperately far from finishing anymore. I already said that the complexity of this feature surpassed my worst expectations, and I can say now that it surpassed even that as well, but I'm very happy now that it's all so close to fully working. The most complex parts are solved and I only have to finish some of the "easy" polishing parts.

    Over the weekend, I made it possible to move lines with some parts of the code folded in them (using Alt+Up/Down arrows). That actually moves the whole block of folded code by one line up or down. And in fact, if the line above or below also contains some folded code, this moves the lines before or after that whole code block. There is one remaining issue that I faced with that - while moving the lines up and down, the folded blocks of code remain folded after the move, but not if I undo the move which is because of the way how undo/redo works in Si3 - it records removing and inserting text but it doesn't record which parts of that text were folded. I think I'll leave that like it is for now because I have a feeling that the right solution might take too much time.

    I even found some time to check again the performance after these changes, and it hasn't changed much, although I found a couple of "low-hanging fruits" that I want to address.

    Thank you all for your continued support! It means a lot to me :)