Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Script Inspector 3

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

  1. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    Minor problem: multiple displays confusion issue (Mac only?)

    Hi guys, I found an interesting, minor, problem.

    - On Mac.
    - Say you have a Mac and you are using one (or perhaps more) extra displays.
    - You launch Unity (with SI3 of course) and work away
    - You possibly quit unity
    - You remove the external displays
    - You again open that project, or perhaps another with SI3, in Unity

    SI3 often gets confused and you WON'T SEE the windows with SI3.

    ie, you double click on your script.cs, and you mysteriously do not see it - in fact the reason is it is on the "other" display (which is not plugged in).

    When this happens there is no way at all to "get back" the SI3 window!

    I did not exactly and precisely investigate the issue (I'm not sure if it happens under what exact circumstances - so, do you have to remove the extra display when Unity running, not running, etc - I'm not certain) but it's easy to repro on a Mac with external displays on hand.

    To workaround, usually if you quit and restart Unity a few times (or perhaps launch with another project, I'm not sure), SI3 comes good.

    It's interesting to note that Unity itself suffers these problems (but then, Unity is by far the most incompetent desktop app developer on the planet), they have improved it over the years but still in some circumstances you can "lose a window" in Unity, if you are messing with displays.

    Solution would probably be:

    At worst, each time open a new file, just check what display/spaces are available, maybe check for any current "lost" windows.

    (It is quite hard to get this absolutely right even in native Mac apps.)

    It's GOOD that SI3 currently respects multi-monitor positions (it would be infuriating if it did not generally remember positions on extra screens, since, most Unity users use 2+ monitors). Cheers!!
     
    Flipbookee and syscrusher like this.
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    7,273
    Yep, I've seen that. I agree that some way to recover these windows would be really helpful.

    If auto-detecting lost windows is hard, I'd be satisfied with a "Reset Window Positions" menu command or prefs button that simply closes all Si3 tabs and forgets the layout, so that next time you open a script, it appears in the default position. Or any other solution that's easy and reliable.
     
    Flipbookee likes this.
  3. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    849
    I've observed this problem with other undocked Unity windows, not just SI3, and I've observed it on both Windows and Mac. It's a Unity issue.

    To work around it on my own systems, I wrote a little script that runs in the editor from a custom menu item. I'm at work right now and about to leave for a medical appointment, but I'll dig up my code later and share it here. :)
     
    Flipbookee and JoeStrout like this.
  4. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    We really do need a Reset Windows button.

    For example, I'm literally "stuck" at the moment on a MacBookPro, there is literally no way to open a window in SI3 - it thinks all are on the other nonexistent monitor!

    As everyone said this is Unity's fault, but it makes SI3 unusable.

    100% of Unity engineers use many monitors, and then when you use your laptop at Starbucks, you're screwed!

    A simple totally reliable solution is just a new menu item, "Default window positions" which brings them all to a simple default on main screen. You often see this in Mac apps all the time for this reason

    ---

    Wait, here's a work-around. Find and delete ScriptInspector.dll.mdb That seems to do the trick
     
    Last edited: Oct 5, 2018
    Flipbookee likes this.
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,259
    Oh really? No way, man :) that's the debugger info for the compiled DLL. Nothing to do with settings and preferences... Weird if that worked for you, I guess, something else is going on.

    I'll add the Reset Window Position command for cases like this. I'm free this weekend, so I can spend more time on Si3 and get it released by Monday.
     
    JoeStrout likes this.
  6. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    126
    how to use ctrl + c and ctrl + v ?
     
    Flipbookee likes this.
  7. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    326
    I have problems like this all the time with multiple displays. I just reset the Layout (Window/Layout/...) and that fixes it. Might work here too?
     
    Flipbookee likes this.
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,259
    Strange that you ask that :confused: ... Do they not work when you press them?
     
  9. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    126
    Nope Unity 2018.3.0.b2
     
    Flipbookee likes this.
  10. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    6
    I have the same Problem ctrl + c and ctrl + v do not work in the Unity beta versions. (I'm using 2018.3.0.b3)
     
    Flipbookee likes this.
  11. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    Hi guys, always looking to improve SI3 ...

    In this example, I started typing "OnCli ..."

    screenshot 1.png

    Notice it perfectly finds "OnClientDisconnect", that's great.

    However, it does "not know" to put in the public override void passage, nor does it put in the function default arguments.

    screenshot.png

    I believe some IDEs do in fact "know" how to do this,

    is this something we could add to SI3 ?? Help me understand!

    We heart SI3 !!!
     
    Flipbookee, Novack and JoeStrout like this.
  12. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    BTW here's a simple example of SI3 getting lost on "monitor issues"

    1. have a script on display2, let's say high on the screen

    2. sleep the computer

    3. disconnect monitor 2,

    4. wake computer

    You'll get this:

    screenshot.png

    (You can't recover from that, there's no way to grab the window and move it.)

    The current logic is probably, for each window,

    1. on awake .. which window are we? (say 2)

    2. does 2 still exist? if not put it on 1

    The logic should be (this is standard in Mac apps or anything that hosts on a mac)

    1. on awake .. which window are we? (say 2)

    2. does 2 still exist? if not put it on 1 AND limit the rect to display1 boundaries

    (at worst, just go "y not less than 50" so the top can't be lost)
     
    Flipbookee and JoeStrout like this.
  13. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    326
    Did you try resetting the layout?

    You can save layouts for different monitor configurations and then switch to that layout when the monitor has been disconnected. Works for me.
     
    Flipbookee likes this.
  14. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    Hey flash,

    the attached image is a bug (it's a minor bug but a bug)

    When you move a window to another display, you have to check (at least!) that the y value is not less than zero. It's a basic in dealing with windows!

    * it's a good point that you can use Unity's "Layouts" menu as an emergency save, thanks, but that thing is buggy and horrible. You can also just find and delete ScriptInspector.dll.mdb as an emergency fix!
     
    Flipbookee likes this.
  15. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    326
    Fair enough. I have this problem with all windows in Unity, even if I don't disconnect my monitor (MacOS). If I let my computer sleep and then wake it, any Unity windows that were on my second display get moved to my main display and cropped like the example in your photo.

    I find resetting the layout works fine, and as with lots of Unity quirks, I've just come to accept it as part of daily life :)

    Sorry for derailing the thread!
     
    Flipbookee likes this.
  16. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    Just BTW many mac users particularly programmers use the insanely addictive MOOM

    screenshot 1.png

    Unfortunately (surprise) Unity has never quite worked properly with it

    (since Unity's Mac programming is totally comic - obviously, Unity is easily the worst-programmed non-trivial Mac software, there is not even a second place. They literally don't know how to handle something as basic as "windows" in ordinary OSX programming - which is just .. I mean you couldn't make it up. It's hilarious. - Unity has never worked totally work properly with Moom or other screen handlers)

    , so unfortunately by inheritance SI3 doesn't work perfectly with Moom either (or the whole thing would be a non-issue, as you'd just use Moom!)
     
    Flipbookee likes this.
  17. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    352
    Hell, no need to apologize, it's a great suggestion!
     
    Flipbookee likes this.
  18. Rocktavious

    Rocktavious

    Joined:
    May 10, 2017
    Posts:
    21
    @Flipbookee I too also have the CTRL + C and CTRL + V issue not working in Unity 2018.3

    I think this has to do with the fact that how unity provides preference options now - because you cannot open the SI3 preferences window anymore either you get the error -
    PreferenceItem is deprecated. Use [SettingsProvider] instead
    UnityEditor.SettingsWindow:OpenProjectSettings()

    So i believe the the SI3 preferences are no longer being evaluated correctly in > 2018.2 because of the changes they made to having a unified settings system.

    Let me know if i can help debug any further. I really love SI3 !!!!!! keep up the good work on it!
     
    Flipbookee likes this.
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,259
    @Rocktavious thanks for the help! I didn't know the Si3 preferences stopped working, so I think I'll fix that easily. And no, the shortcuts not working has nothing to do with that, but with an amazing thing that finally got fixed in Unity - custom Unity tabs can now handle all keyboard input before it gets handled by the main menu!!! :eek: This is great and it's the right way to process keyboard input, as now Si3 can handle even shortcuts like Cmd-S and Cmd-Z without the keyboard plugin, yay!!!

    However, Si3 wasn't made with such assumption in mind - I just thought they are never going to fix that, so now I have to adjust it to these new conditions. I tried to find a quick workaround this morning and I posted the solution here:
    https://forum.unity.com/threads/scr...est-ide-for-unity.138329/page-45#post-3758479

    That's not a perfect solution, but it let's you use the Cut, Copy, and Paste shortcuts at least. Most of the other main menu shortcuts still don't work, so I'll try to find a better fix now...

    @Fattie, @xxhaissamxx, @ElevenGame, and @flashframe sorry I missed your recent posts! I hope that quick fix works for you guys until I find a better way to fix that.
     
    ElevenGame likes this.
  20. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,259
    Yeah, I see what you mean. Si3 knows how to do this as well, just the way it does that is maybe a bit different. You'd have to type the "override" keyword first, then press space and you'll get suggestions to auto-generate all override method that aren't already overridden in that class. I think @Novack suggested Si3 should also handle the cases as in your example as well, and I've starting coding that up, but I never found time to finish that. I still have that here, half-finished ;) so I'll check what I can do...

    I still have no idea why is deleting the .mdb file helping the multi-monitor issue, but if that really works, just keep doing that until I add something nicer.
     
    Last edited: Oct 7, 2018
  21. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    319
    Hi, thanks for making this asset I use it all the time is it possible to turn off the auto indenting? I spend a lot of time fighting against this feature trying to format my code how I want. Especially comments which I don't want indented at all.
    I want Tabs but I want them manual when I press the tab key not when the editor thinks I might want them.

    Kind Regards

    Roy
     
    Flipbookee likes this.
  22. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,259
    Hey Roy, thank you for the compliments! :cool:

    I'll add an option to turn the auto-indenting off. Until then, please turn it off by a small change in Si3 code. Open FGTextBuffer.cs and go to line 2232, which should be the beginning of the CalcAutoIndent method. Then add at its beginning a "return null;" statement, save it, let Unity recompile the change, then try it right there in that same file - it should work the way you wanted. :)

    Let me know if that change isn't actually doing what you wanted. If it does, you're fine for now and until the next release, which I seriously hope is going to happen by Monday, then you'll have to turn the auto-indenting from the Si3 Preferences. In meantime, please remember to rate Si3 or maybe even post a small review to let the potential future Si3 users know what they've been missing out.

    Many thanks!