+26
posted by Martin Schultz, updated 1 year ago , 16


Vote

Unity 3D (unity3d.com) does not work yet proper with Sublime. Unity uses the BareBone API on OSX to send the text editor the line number. Sublime does not make use of that (yet still unofficial) BareBones API, but other editors like TextMate do it already since ages and it would be great if Sublime could support this too.

I would also love to see this. Unity is an incredibly popular engine and as IDE's go, Sublime Text 2 is AMAZING, but only missing the connectivity with Unity to allow us to dbl click in the Unity console window, on an error or output message and have Sublime open that script at that line number.


Unity uses the AppleEvent system to talk to IDE processes and pass it file names and line numbers etc.. but it doesnt look like SUblime uses this methodology.

I would love to see this as well!

ST2 is an awesome editor... I use Unity3d all day so I would love to be able to fully switch to it for my work. This would help a lot.


+1. love to use ST2 with Unity and dump that slow as Monodevelop as my IDE.
+1
I created a mono project that might work to call sublime with the proper file and line number.  It works on windows, but my mac is busted right now (and the money for a new mac-mini went to the Unity 4 license upgrade).   https://github.com/rstehwien/UnityExternalScriptEditorHelper 

I also have a package for running monodevelop builds in unity  https://github.com/rstehwien/Sublime-MonoDevelop  

This thread discusses this a bit (and someone posted a blog entry that consolidates some info) http://forum.unity3d.com/threads/128352-Using-Unity-with-Sublime-Text-2-(How-to-get-everything-set-up) 

I've tried googling this "BareBones API", didn't find anything interesting. What is this and how does it work? 

@Robert Stehwien: I'm trying to get this to work on mac (doing something similar to your code), but the command line arguments from unity are just not coming through. All I get is something like "-psn_0_6358544". The number changes when I click on an other file in unity.

On OS X, it uses Apple Events. You are correct there are no command line arguments being sent to the 3rd party editor :(

It seems like sublime text 2 isn't paying attention to the 'kpos' parameter of the 'odoc' apple event.   If I do this with BBEdit the apple even sent is the same but the insertion point is place in the correct place:


Oct 22 12:30:33 com.barebones.bbedit[32725]: { 1 } 'aevt':  aevt/rapp (i386){

Oct 22 12:30:33 com.barebones.bbedit[32725]:           return id: 32699 (0x7fbb)

Oct 22 12:30:33 com.barebones.bbedit[32725]:      transaction id: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:   interaction level: 112 (0x70)

Oct 22 12:30:33 com.barebones.bbedit[32725]:      reply required: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:              remote: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:       for recording: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:          reply port: 10507 (0x290b)

Oct 22 12:30:33 com.barebones.bbedit[32725]:   target:

Oct 22 12:30:33 com.barebones.bbedit[32725]:     { 1 } 'psn ':  8 bytes {

Oct 22 12:30:33 com.barebones.bbedit[32725]:       { 0x0, 0x2f02f0 } (Unity)

Oct 22 12:30:33 com.barebones.bbedit[32725]:     }

Oct 22 12:30:33 com.barebones.bbedit[32725]:   fEventSourcePSN: { 0x0,0x2f02f0 } (Unity)

Oct 22 12:30:33 com.barebones.bbedit[32725]:   optional attributes:

Oct 22 12:30:33 com.barebones.bbedit[32725]:     < empty record >

Oct 22 12:30:33 com.barebones.bbedit[32725]:   event data:

Oct 22 12:30:33 com.barebones.bbedit[32725]:     { 1 } 'aevt':  - 0 items {

Oct 22 12:30:33 com.barebones.bbedit[32725]:     }

Oct 22 12:30:33 com.barebones.bbedit[32725]: }

Oct 22 12:30:33 com.barebones.bbedit[32725]: { 1 } 'aevt':  aevt/odoc (i386){

Oct 22 12:30:33 com.barebones.bbedit[32725]:           return id: 32700 (0x7fbc)

Oct 22 12:30:33 com.barebones.bbedit[32725]:      transaction id: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:   interaction level: 16 (0x10)

Oct 22 12:30:33 com.barebones.bbedit[32725]:      reply required: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:              remote: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:       for recording: 0 (0x0)

Oct 22 12:30:33 com.barebones.bbedit[32725]:          reply port: 10507 (0x290b)

Oct 22 12:30:33 com.barebones.bbedit[32725]:   target:

Oct 22 12:30:33 com.barebones.bbedit[32725]:     { 1 } 'psn ':  8 bytes {

Oct 22 12:30:33 com.barebones.bbedit[32725]:       { 0x0, 0x2f02f0 } (Unity)

Oct 22 12:30:33 com.barebones.bbedit[32725]:     }

Oct 22 12:30:33 com.barebones.bbedit[32725]:   fEventSourcePSN: { 0x0,0x2f02f0 } (Unity)

Oct 22 12:30:33 com.barebones.bbedit[32725]:   optional attributes:

Oct 22 12:30:33 com.barebones.bbedit[32725]:     { 1 } 'reco':  - 1 items {

Oct 22 12:30:33 com.barebones.bbedit[32725]:       key 'shas' - 

Oct 22 12:30:33 com.barebones.bbedit[32725]:         { 1 } 'list':  - 1 elements {

Oct 22 12:30:33 com.barebones.bbedit[32725]:           { 1 } 'TEXT':  218 bytes {

Oct 22 12:30:33 com.barebones.bbedit[32725]:             "7a4094ec7aca52f44c117bac760ca3116372834c;00000000;0000000000000020;com.apple.app-sandbox.read-write;00000001;0e000002;0000000000a9cf30;/users/private/documents/work/projects/tests/terraintest2-unity/assets/terraintest.cs"

Oct 22 12:30:33 com.barebones.bbedit[32725]:           }

Oct 22 12:30:33 com.barebones.bbedit[32725]:         }

Oct 22 12:30:33 com.barebones.bbedit[32725]:     }

Oct 22 12:30:33 com.barebones.bbedit[32725]:   event data:

Oct 22 12:30:33 com.barebones.bbedit[32725]:     { 1 } 'aevt':  - 3 items {

Oct 22 12:30:33 com.barebones.bbedit[32725]:       key '----' - 

Oct 22 12:30:33 com.barebones.bbedit[32725]:         { 1 } 'fsrf':  80 bytes {

Oct 22 12:30:33 com.barebones.bbedit[32725]:                 000: 9cff 0080  0000 0000  30cf a900  9ed7 9000     ........0.......

Oct 22 12:30:33 com.barebones.bbedit[32725]:                 001: 0000 0000  0000 0000  0000 0000  0000 0000     ................

Oct 22 12:30:33 com.barebones.bbedit[32725]:                 002: 0000 0000  0000 0000  0000 0000  0000 0000     ................

Oct 22 12:30:33 com.barebones.bbedit[32725]:                 003: 0000 0000  0000 0000  0000 0000  0000 0000     ................

Oct 22 12:30:33 com.barebones.bbedit[32725]:                 004: 0000 0000  0000 0000  0000 0000  0000 0000     ................

Oct 22 12:30:33 com.barebones.bbedit[32725]:          

Oct 22 12:30:33 com.barebones.bbedit[32725]:         }

Oct 22 12:30:33 com.barebones.bbedit[32725]:       key 'kpos' - 

Oct 22 12:30:33 com.barebones.bbedit[32725]:         { 1 } 'TEXT':  20 bytes {

Oct 22 12:30:33 com.barebones.bbedit[32725]:           "



basically seems like the sublime text 2 programmers aren't paying attention to that last appleevent arguement 'kpos' that Unity is sending out.  Maybe someone knows them and can suggest/request that they add this ASAP!  :)


BTW - this is nothing to do with a BareBones API - this is straight up Apple Events Open Document Apple Event parameter documented here:


http://developer.apple.com/legacy/mac/library/documentation/mac/pdf/Interapplication_Communication/AE_Term_Resources.pdf


search for "keyAEPosition"

+1 please add this! It would make it so much better for us unity folk :)

Indeed it's straight up Apple Events handling. The reason, apparently that TextMate and MacVim work correctly when Unity3d launches them, is because of their scripting implementation. It doesn't work with SublimeText 2 or 3. So yeah, big bump here!

BUMP


Unity has something like 1 million registered users. Support = $$$$

SUPPORT THIS PLEASE. Almost a deal breaker to not have it and I'm loving many other things about the editor...

Check out the beta of Sublime Text 3. 

It goes to the right line! :)

Oh nice thanks Peter! Had to go through some steps to import package control through Git as it's not there by default in the beta but have everything setup perfectly with Unity Autotype etc. I'm instantly a fan, this editor is fantastic..