Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Utilities Script Inspector 3

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

  1. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    Bad news for today

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. FGTextBuffer.GetNonTriviaTokenLeftOf (Int32 lineIndex, Int32 characterIndex) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextBuffer.cs:2262)
    3. ScriptInspector.FGListPopup.Create (ScriptInspector.FGTextEditor editor, Rect buttonRect, Boolean flipped) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGListPopup.cs:377)
    4. ScriptInspector.FGTextEditor.Autocomplete () (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:5832)
    5. ScriptInspector.FGTextEditor.DoGUIWithAutocomplete (Boolean enableGUI) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:2565)
    6. ScriptInspector.FGTextEditor.OnWindowGUI (UnityEditor.EditorWindow window, UnityEngine.RectOffset margins) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:2453)
    7. ScriptInspector.FGCodeWindow.OnGUI () (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGCodeWindow.cs:1022)
    8. 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)
    9.  
     
    Flipbookee likes this.
  2. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hmm, did this maybe happen immediately after a compile/reload?
     
  3. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    To say the true, I really don't know, after a while I look at the console and it was already there, so no hint or reproduceble case I think :( Will aware of it tell you next time if I came across :)
     
  4. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    No worries, I fixed it anyway. Just wanted to know if there's an easy way to reproduce that...
     
  5. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    Bad news for today ... This time for the console :)
    Code (CSharp):
    1. count <= std::numeric_limits<UInt16>::max()
    2. System.Reflection.MethodBase:Invoke(Object, Object[])
    3. ScriptInspector.FGConsole:OnGUI() (at Assets/Thuan/ScriptInspector3/Editor/Scripts/FGConsole.cs:223)
    4. UnityEditor.DockArea:OnGUI()
    5.  
    Another one for SI3, when I scroll to the right to edit at the end of the string, for every keystroke, SI3 flicker once
    Code (CSharp):
    1. Debug.Log(string.Format("GameObject={0}\n Components={1}\n skipArray={2}\n skipProperty={3}\n nullCount={4}\n monoCount={5}\n materialCount={6}\n textureCount={7}\n spriteCount={8}\n shaderCount={9} textCount={10}",
    2.             gameObjectCount,
    3.             componentCount,
    4.             skipArrayCount,
    5.             skipPropertyCount,
    6.             nullCount,
    7.             monoCount,
    8.             materialCount,
    9.             textureCount,
    10.             spriteCount,
    11.             shaderCount,
    12.             textCount)
    13.         );
     
    Flipbookee likes this.
  6. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Is it too late to request a new unity specific feature?

    Open the code file for the custom inspector for a MonoBehaviour. :)
     
    Flipbookee likes this.
  7. crafTDev

    crafTDev

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

    Any new betas yet?

    Thanks,
    jrDev
     
    Flipbookee likes this.
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hey @thienhaflash, those are two other great finds! Thanks! :)
    EDIT: Although, I can't repro the second one... I see the tooltip is flickering, is that what you mean?

    @UnLogick, how would that look like? Any idea?

    @jrDev, sorry man, not ready yet... There are 45 change lists so far in my Perforce depot since the last beta. Many of these are bugfixes, and also P4Connect integration, resolving of extension methods (no auto-complete for that yet), new Execute Static Method function that was made by @UnLogick (without my help, to my big surprise!), a Go To Line function, Find in Files function (which is not finished yet), and some tiny improvements here and there... The missing auto-completions for extension methods is the most important thing that prevents me now to send you a new version. But I'm working on it... ;)
     
    Last edited: Jul 13, 2015
  9. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
  10. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Oh, I see! That's pretty bad. I'll investigate...
     
  11. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    @Flipbookee, How about added to the Context Menu on the class name with a shortcut. The shortcut could be relaxed about cursor position so you don't actually have to be on the class name. But you would have to keep track of all inspector attributes I guess.
     
    Flipbookee likes this.
  12. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @UnLogick, yes, that's easy. I thought you'd say "right-click on the custom inspector a choose Edit" :p that would be awesome, but not possible AFAIK. Extending functions next to Go To Definition is simple. Go To Type is one such easy to get function :)
     
  13. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    @Flipbookee, what a splendid suggestion to integrate it into the inspector header, and in case no such editor file exist it will create an Editor folder relative to the mono behaviour and create the (filename)Editor.cs file from a template. :p
     
    Flipbookee likes this.
  14. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @UnLogick, I just checked, that's totally doable! :D I think I love Unity
     
  15. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I've worked with Si3 for a while now and there is one MUST have feature. Delayed save... also known as save without recompile!

    Obviously I want your parser to parse the file and update intellisense, but I do not want Unity to recompile everything. It goes without saying that when I subsequently do a proper save it should save all the code files too, and if anyone have the audacity to press play or something then you need to intercept that as well.
     
    Flipbookee likes this.
  16. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @UnLogick Yep, all that's done already! ;)

    Check the settings in Unity Preferences -> Script Inspector -> Editor tab... Here you can make Si3 to interpret the first save as a quick save without compile, and the second one as a recompile. Effectively you'll get: save once for a quick-save, save twice for save and compile. :D And of course, no need to save or recompile before entering editor game mode - Si3 saves all your changes (and Unity compiles them) on pressing the Play button! :cool:

    How cool is that now? ;)
     
    Novack and UnLogick like this.
  17. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Epic!
     
    Flipbookee likes this.
  18. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @thienhaflash Yay, I finally found and fixed the bug that was hanging Unity in some cases after Go To Definition! :D

    Next update is coming tonight :cool:
     
    FireMutant and UnLogick like this.
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Good news for today:

    Si3 Beta 7 got just released! :cool:

    And this is a quick list of the new features and improvements:
    • Resolving of extension methods with auto-completions and handling of generics!!!
    • P4Connect integration - optional, only if you add P4Connect to your Unity project
    • Read-only files can't save (unless you remove the read-only attribute)
    • Added a warning message with option to edit in memory for read-only files
    • Added option in Preferences->Si3 to make the caret twice thicker
    • Added Execute command for static methods (thanks @UnLogick)
    • Handled the Context Menu key (again, thanks to @UnLogick)
    • Added Go To Line command on Ctrl+G (Ctrl-G or Cmd-L on OS X)
    • Go Back and Go Forward will ping the cursor
    • Holding Ctrl on PC or Cmd on Mac while double-clicking a file in Project view will invert your settings for opening in Si3 or external IDE
    • On opening a new SI tab the hidden tabs will reappear too
    • Lots of bug fixes :p
    Enjoy! :D
     
  20. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    Trying out the new beta, pretty good so far ... I don't see where the Find & Replace panel is, maybe it's not there yet ? :D
     
    Flipbookee likes this.
  21. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Hi Flipbookee,

    I noticed there's a separate thread for Si3, better write my feedback here... ;)
    Si3 is installed and running for a couple of hours now without any problems, seems to do its job just fine...

    After a couple of hours working with Si3 I'm overwhelmed with the ease and speed of Si3, in the Si2 thread I wrote something about I have to see Si3 more as an addition to the IDE instead of a complete new IDE but I have to take back those words I guess. If you just add some features like opening files from within Si3 and search in files it will be perfect for me. I'm glad I purchased Si3, it will be the first Asset to load in any future projects!

    Great Show!
    Cheers,
    Franco Palmieri - Fronne
     
    Last edited: Jul 29, 2015
    Flipbookee likes this.
  22. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Still no "bad news"? :p

    He, he, I started working on a Find in Files / Find All feature, thought it will be a quick one but it wasn't really, so I've decided to exclude that from this release.
     
  23. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Thanks man!!! :D So glad you liked it - my time wasn't wasted for nothing :p

    Find in Files is half finished. There's no classic Open File function, but there are so many other alternatives... Unless... Hmm, wait, I just got an idea... Let me try something...
     
    Fronne likes this.
  24. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @Fronne Guess what? Si3 just got a cool Open command! :D

    All you have to do is to put this C# script in an Editor folder:
    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. namespace ScriptInspector
    5. {
    6.  
    7. static class Si3OpenAnyFile
    8. {
    9.     static TextAsset selected;
    10.  
    11.     [MenuItem("File/Open in Si3 #%o")]
    12.     static void OpenInSi3()
    13.     {
    14.         EditorGUIUtility.ShowObjectPicker<TextAsset>(null, false, null, 0x51309);
    15.         EditorApplication.update += WaitForObjectPicker;
    16.     }
    17.  
    18.     static void WaitForObjectPicker()
    19.     {
    20.         var objectPickerId = EditorGUIUtility.GetObjectPickerControlID();
    21.         if (objectPickerId == 0x51309)
    22.         {
    23.             selected = EditorGUIUtility.GetObjectPickerObject() as TextAsset;
    24.         }
    25.         else
    26.         {
    27.             EditorApplication.update -= WaitForObjectPicker;
    28.             if (objectPickerId == 0 && selected != null)
    29.             {
    30.                 var path = AssetDatabase.GetAssetPath(selected);
    31.                 if (path.StartsWith("Assets/"))
    32.                 {
    33.                     var guid = AssetDatabase.AssetPathToGUID(path);
    34.                     FGCodeWindow.OpenAssetInTab(guid);
    35.                 }
    36.             }
    37.          
    38.             selected = null;
    39.         }
    40.     }
    41. }
    42.  
    43. }
    Let Unity compile that and you'll get a super-awesome-mega-cool Open Any Script, Shader, or Text File in Si3 from Anywhere command executed on Ctrl+Shift+O on PC or Cmd-Shift-O on Mac :D

    I've only tested this with Unity 5.1 and I'm not sure what is the earliest version of Unity in which this can compile... Try it out - let me know ;)
     
    Fronne likes this.
  25. Callski

    Callski

    Joined:
    Feb 3, 2013
    Posts:
    130
    @Flipbookee The latest update is absolutely awesome! Thank you!
     
    Fronne and Flipbookee like this.
  26. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Hi Flipbookee,

    Works PERFECT, THNX a lot (again)!!!

    One more question, I have a script folder (who doesn't) named _Scripts. Do you know how to acces (with another command) this folder, I tried to figured it out myself but couldn't find the documentation to change the path, changing the path in your code does nothing. The path I like to access is "Assets/_Scripts/", I have about a xillion other .cs scripts, sometimes I forget the filename, if I have access to this folder only with another command it would be great...
    I only need to know how to set the desired path, rest should be easy... :p

    One more thing I like to change, I like to navigate to the online Unity API reference pressing Control+' (right now Si3 navigates to my local Reference, stored on my PC...

    Cheers,
    Franco Palmieri - Fronne
     
    Last edited: Jul 29, 2015
    Flipbookee and Funder75 like this.
  27. Callski

    Callski

    Joined:
    Feb 3, 2013
    Posts:
    130
    Recently with the latest version of script inspector on OS X Unity 4.6.7f1 I've had a weird bug with the script inspector tabs. I have five tabs open right now, and when one is selected, it ends up growing depending where the mouse is on the screen to cover all other tabs. I can't figure out what triggers this, and it seems to self correct. Just keep an eye out for this. It isn't a big deal, just annoying when it happens.
     
    Fronne and Flipbookee like this.
  28. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @Callski, it that this thingy?

    TooManyTabs.gif

    Because this is intentional and it's there so we can see and read longer names. It's only a visual effect and the tabs still work as before,, but if this is too distracting you can turn it off from Preferences -> Script Inspector -> Si3 tabs -> Expand on mouse-over.

    I'll set this option to off by default to avoid confusion... :-\
     
    Fronne likes this.
  29. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @Fronne, add this script instead of that other one:
    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. namespace ScriptInspector
    5. {
    6.    
    7. static class Si3OpenFile
    8. {
    9.     static TextAsset selected;
    10.    
    11.     [MenuItem("File/Open in Si3 #%o")]
    12.     static void OpenInSi3()
    13.     {
    14.         var projectDir = Application.dataPath;
    15.         var currentDir = projectDir;
    16.         var guidHistroy = FGCodeWindow.GetGuidHistory();
    17.         if (guidHistroy.Count >= 1)
    18.         {
    19.             var lastAssetPath = AssetDatabase.GUIDToAssetPath(guidHistroy[0]);
    20.             currentDir = System.IO.Path.GetDirectoryName(lastAssetPath);
    21.         }
    22.        
    23.         var open = EditorUtility.OpenFilePanel("Open in Script Inspector", currentDir, "cs;*.js;*.boo;*.shader;*.txt");
    24.         if (!string.IsNullOrEmpty(open))
    25.         {
    26.             if (open.StartsWith(projectDir))
    27.             {
    28.                 open = open.Substring(projectDir.Length - "Assets".Length);
    29.                 var guid = AssetDatabase.AssetPathToGUID(open);
    30.                 FGCodeWindow.OpenAssetInTab(guid);
    31.             }
    32.         }
    33.         System.IO.Directory.SetCurrentDirectory(projectDir.Substring(0, projectDir.Length - "/Assets".Length));
    34.     }
    35. }
    36.    
    37. }
    This one will open a standard Open File dialog starting from the same folder where the last edited script was located.

    You can add more file extensions if you want. And you can even have both of these script, just make sure to assign different menu shortcut (currently they are same).

    Enjoy! :D
     
    Last edited: Jul 22, 2015
    Fronne likes this.
  30. Callski

    Callski

    Joined:
    Feb 3, 2013
    Posts:
    130
    I like this feature! It just glitches sometimes so that instead of unrolling to show the name, it continually unrolls and covers up all tabs. So there's one big tab. If it happens again I'll try to screenshot it!
     
    Flipbookee likes this.
  31. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @Fronne, dammit, I've posted that script too soon! There were two bugs, one in the file types filter, and the second one is mostly Unity's fault - seems like EditorUtility.OpenFilePanel can change the working directory and we have to set it back manually or otherwise Unity will complain and quit! :D

    The filter, as it is now, works on Windows but it may not work on OS X - I haven't tried that yet...

    I've updated the script, so please take it again ;)
     
  32. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @Callski, oh I see... I'll check the code, but please send me a screenshot if you see it again,
     
  33. inventor2010

    inventor2010

    Joined:
    Nov 3, 2010
    Posts:
    124
    @Flipbookee Got a present for yah! -- I need to get going so I'll try and keep it "quick". :p

    Basically... I got board (usually good for someone when that happens...) ;)

    Any Way....

    I made a simple little example using a custom mac bundle (think dll) that implements "global keycombos" (got sick of all the weird combos and trying to research a hack similar to what you used on windows) - so basically, you can implement with it whatever keycombos you want (cmd+z & shft+cmd+z please!!! :D) and it will prevent Unity, or if you wanted to be sadistic, ANY application from accessing it (almost any anyway).

    Obviously, that isn't ideal, since it will override the keycombo system wide and what not, and I'm not even sure UT would like that (whether we fix it or not), but it's a start. And if they didn't except the bundle in an asset store submission... well... least you could post it here... I think Objective C could watch out for that without having to start the hook and stop it within unity, (I mean I got that to work in a separate test app I made, you just get a "NSNotification" as the app (IE unity - as the bundle user) leaves the foreground, or re-enters). But I'm not sure how well it works inside a bundle... needs testing...

    If you have a Mac for development - You're welcome to finish it if you like (assuming you're comfortable with Xcode of course). It's just an example atm though. I tossed in a simple Unity runtime example (mac only obviously) to "Start the Hook" and "Stop the Hook". It's hard coded in Xcode to override cmd+s when the "hook" is running and return 1 to what ever C# delegate you give it upon cmd+s click. But it should be relatively easy for one of us to right a simple list of keycodes to watch on the bundle side of things and some simple functions for Unity to add and remove combos to that list.

    If you'd like I can make up a better bundle with a simple interface latter, but I wanted to get this out there quick since I need to get going and so you could see it, case your still ripping your hair out on & off with this. :p

    See attached!

    Cheers!



    FYI - Awesome Job as usual - Keep up the good work! (I used SI beta 7 for all the testing I did on this ;))


    Oh... and story about the bug post a while back - I don't even remember if I replied... lots happening lately... but turned out it wasn't SI... Mono actually doesn't properly implement something with the serial routines in mac (least a certain version of mono - publicly known bug) I'm on Unity 5 now, so fixed.... it just kinda looked like SI cause of how/when it was crashing
     

    Attached Files:

    Fronne and Flipbookee like this.
  34. crafTDev

    crafTDev

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

    Tested out new Beta and it's FANTASTIC as always. I have noticed a bug where when you click on an error reference in the SI console to jump to the line with the error, it just opens without jumping to the line. I right click in the console to get the line number then scroll to it and it looks like it attempts to get to the line because the line is apparently highlighted. Dunno if you can reproduce but it happens quite a bit.

    Thanks for the updates, looking forward to find and replace in files!

    Thanks,
    jrDev
     
    Fronne and Flipbookee like this.
  35. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    So, bad news for today ... everywhen you close other SI tabs or close all SI tabs

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.EditorWindow.Close ()
    3. ScriptInspector.FGCodeWindow.<AddItemsToMenu>m__78 () (at Assets/Thuan/ScriptInspector3/Editor/Scripts/FGCodeWindow.cs:1333)
    4. UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected)
     
    Fronne and Flipbookee like this.
  36. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
  37. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @jrDev, yes, I've seen that a couple of times. Seems to be related to my changes to how scrolling works when I was adding the smooth scroll option... I'll investigate!
     
  38. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @inventor2010, Wow, that's impressive! Thanks man! :) I'll need some time to understand all this, but your comments in code will help with that... Thanks for the links too! :)
     
  39. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    THNX AGAIN Flipbookee,

    This is exactly what I meant, it works like a charm! When restarting Unity it even remembers the last work directory and will navigate me to the file I want to open in no time at all, working with Si3 is a even faster then yesterday...

    Did you wrote those scripts because I asked for it? If so, I owe you one or two. If not, I owe you one or two too... ;)

    I still have to use MonoDevelop every now and then because of two reasons:
    • Pressing Control+' is not directing me to the online Unity API Refeference
    • Find/Replace in Files
    I'm new to Unity, I have just about six months (12 months if you count the hours) experience so the Control+' is very important to me (most likely for other "beginners" too), at this time, Si3 is directing me to the local reference which is a huge mess in my case, it's impossible to find what I need like that...

    I will launch our first #1 App :cool: next month so I don't have the time right now to jump in Unity's editor code in a serious way but if you tell me where to start I can give it a try myself (I know you're very busy too)...

    Cheers,
    Franco Palmieri - Fronne
     
    Last edited: Jul 30, 2015
    Flipbookee likes this.
  40. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Ha, ha, nice! :D

    The change to use online documentation should be a simple think. I'll add that option!

    Yeah, I wrote the scripts because you asked for that :p but also because I wanted to show you and the others how easy it is to add some functionality to Si3. A few days ago I was talking to @UnLogick, explaining him how easy that is, but then I wanted to try that and see am I maybe wrong? And it turned out to be surprisingly easy thanks to Unity's rich API and the fact I am familiar with that... Have you ever wanted to mod your IDE? Now you can do that without having to learn a new programming language and whole new environment! Modding your IDE has never been easier :cool:
     
    Last edited: Jul 24, 2015
    Fronne likes this.
  41. Callski

    Callski

    Joined:
    Feb 3, 2013
    Posts:
    130
    Here's pictures of what's sometimes happening. Again, this is very rare, and when it happens, just minimizing and bringing the window back up seems to fix it. It's not a major issue for me on OS X.

    Edit: Just look at the script tabs in the images. That's where the problem is.
     

    Attached Files:

    Flipbookee likes this.
  42. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Sorry if this feature has been already asked and/or scheduled, but one of the reason why I keep going back to MonoDevelop is the automation when overriding methods, implementing interfaces or extending abstract classes.
    MonoDevelop automatically fills the code for you.
    In case you will implement these features, one thing missing in Mono (in my opinion), is to re-apply the comments of the method of the parent class/interface, over the overridden one (also with all the comments of the params).

    By the way, thank you for your effort on Si3. It's really really a master piece.
     
    Fronne and Flipbookee like this.
  43. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Thanks @Callski! Gorgeous screenshots :D (apart from the bug :p)

    @mcmorry, I was tempted many times to start working on refactoring features, but that would have delayed the release data... My current goal is to release Si3 next week, so let's see how is that going to go first ;)

    Thanks for the great suggestions!!!
     
  44. Deleted User

    Deleted User

    Guest

    Is there a shortcut to quickly switch from and to the script editor?
     
  45. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    Hmm, what do you mean exactly?
     
  46. Deleted User

    Deleted User

    Guest

    Like alt tabbing back and forth from visual studio to unity. Instead of selecting each tab with the mouse. basically shortcuts
     
  47. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @LordPhill, there is a shortcut in Script Inspector to open the active script in an external IDE with the cursor moved to the same line as in SI. No external IDE can do the opposite currently, that would require an extension for that particular IDE to send the request back to SI and some code in SI to handle the request since Unity can't do that... Was that your question?
     
  48. inventor2010

    inventor2010

    Joined:
    Nov 3, 2010
    Posts:
    124
    @Flipbookee Made an updated Mac Keyboard "Hook"

    See attached.

    Rev 3 includes adding of multiple key combo's (bit of a un-xpected pain, wasn't shown in my previous reference either... see readme if your interested). I hard coded a few into the runtime example along with an lengthy excerpt from the mac key-codes list for ease of use. And, of course, it returns which one was pressed to the c# delegate! :D

    Rev 2 (throw'n it in here since it's a lot simpler with less changes -- good reference maybe) just adds the Obj-C way of auto checking if Unity is in the foreground or not (not much different than I thought it'd be... but implementing it is a little weird if you aren't use to Objective-C).

    Real mac key combos should be a piece of cake now! :cool::D

    Just start with the Unity function's (implemented at the bottom of the Xcode proj), and work your way in from there. Figuring that much out should be easy. Let me know if you see any problems. I'll probably stick this on the wiki at some point, once I know it works well for people and I, maybe, clean it up a bit.
     

    Attached Files:

    Last edited: Jul 26, 2015
    Flipbookee likes this.
  49. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @inventor2010, thanks man!!! :D

    I just tried it and I got a "License error. This plugin is only supported in Unity Pro!" :( I should have expected that, native plugins were only supported in Pro before Unity 5...

    I've spent the whole day yesterday searching for alternative solutions, without using native plugins but by importing OS functions in a similar way as I did that on Windows. This method doesn't require Unity Pro, at least on Windows.

    I had to learn many things about OS X, most of which are completely new to me... I've managed to import the functions that I need, but I got stuck at the point where I had to pass an Objective-C block to an Objective-C function that encapsulates my C# delegate, which is also doable but finding internet resources that show how to do this from C# is very difficult. If anyone knows how to do that, please let me know!

    The method I am trying to go for right now is to use NSEvent.addLocalMonitorForEventsMatchingMask which is very simple when used from Objective-C, but creating the bridge from non-Objective-C languages is complicated only because it doesn't take a regular function pointer but a ObjC block.

    The nice thing about this method is that it doesn't watch for keyboard events outside of the current application, so there's no need to monitor switching to and from the application. It also has a nice option to "cancel" the event if it has been consumed, so if Cmd-S gets handled by Si3 then Unity will not receive that event. @inventor2010, can your method do that? Because we still have to prevent the Save Scene command on Cmd-S somehow...

    One thing I'm still not sure of is my event monitor going to be called before the menu bar processes the shortcut or after that :p... This should be easy and quick to verify by someone who's comfortable with Xcode and has Unity 5 or Pro, so please guys let me know if you can check that out for me :)... Because if this method doesn't work then there's another one that I'm pretty sure will work, and that one doesn't require Objective-C blocks, so I'd go for that instead ;)

    This is now quite an urgent thing, and all your help will be highly appreciated! If I don't have a working solution by the end of today I'll have to stop working on this and get Si3 ready for the release. It has to be released latest by Thursday which is now the final and fixed deadline! Don't worry if any feature doesn't make its way into the release version, Si3 will get frequent updates even after the release! :cool:
     
  50. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I never thought that these features should be included now in the release of Si3. Just for future version, maybe Si4 :p

    About your request for support on OSX, I could try to help you. I'm on Unity 5 but I used XCode just to build my game for iOS.
    If you have some code to start from and test I could try.
     
    Flipbookee likes this.