Sublime Forum

Help get SublimeText launching correctly from Unity3d!

#1

Hi all, I recently bought SublimeText. I really want to use it to edit code with http://unity3d.com game engine. I know Sublime is not going to replace Unity’s default editor, Monodevelop, which has integrated debugger, .NET awareness, etc. But for quick code edits and fixes, it would be a perfect match.

edit: I am aware there are several Sublime plugins to add C# + Unity support on the editor side- which is great. However there is an issue when Unity launches the 3rd party editor:

On OSX Unity does something weird when launching a 3rd party editor app: It sends an Apple Event to invoke the editor, open a file and go to line. All I know for sure is it’s using AECreateAppleEvent and keyAEPosition. If this event is handled correctly, the editor should open up in that file and in that context (line+column or at least correct line)

This currently works correctly OK with:

Unitron.app (Unity’s old code editor)
Unity-Monodevelop (custom version of Monodevelop shipped with Unity)
*TextMate.app!
*MacVim.app!
*]The latter two, I assume it work correctly more or less by chance because of how their Applescript / Apple Events interface was implemented.

It does not work correctly with:
SublimeText.app (tried v2 and 3)
Emacs.app
and probably most other text editors…

It would be great if ST3 could handle whatever apple event Unity is sending the text editor. It might be as simple as inspecting the source to MacVim and seeing how it handles them.

In the future I am hoping that Unity3d will just provide a shell command template, so we can just launch with the subl tool from the shell. However, in the meantime, unfortunately, this is how Unity opens the external editor on OS X.

And/Or if anyone has any ideas for making an applescript .app bridge, that can capture the event and open subl with a shell command, well that would be pure genius!

0 Likes

#2

Aha! more applescript details in this wishlist thread

sublimetext.userecho.com/topic/1 … h-sublime/

0 Likes

#3

Although this might sound like a very obscure use case, consider that Unity3d had 1 million registered developers as of last year. And many of thos devs on OS X. :ugeek:

0 Likes