Unity Community


Page 1 of 11 123 ... LastLast
Results 1 to 20 of 214

  1. Location
    NC, USA
    Posts
    30

    Using Unity with Sublime Text 2 (How to get everything set up)

    Hey guys, I've seen a couple of threads around here asking questions about using Sublime Text 2 with Unity. I just want to say that I have been coding for Unity in Sublime for about the past year and it has been really wonderful.

    I also wanted to share with you some of my plugins that I use to make the Unity/Sublime experience even better.
    Here is a video about them so check it out.


    They were all integrated into Sublime's package control system about a week ago so they are very easy to install.
    there are 3 plugins in total and they include:
    1. Adding Syntax highlighting for C# and Javascript
    2. A pluging that lets you highlight any Unity Class/function and right click to do a Unity reference search
    3. A plugin that gives some snippets and autocompletes of Unity functions (this one is still a work in progress, fork my github package and help me out)


    You can find more info about them and other tips for using Sublime (like how to get it to jump to the correct line from the console) on my blog post here.


  2. Location
    NC, USA
    Posts
    30
    I just figured out how to call into unity's mono build system from within sublime text 2, so you can program in sublime and get error reporting back within sublime's console, all without even running the unity editor.

    Comment if you are interesting in knowing how.


  3. Posts
    50
    Oh yes, tell us how!

    And thanks for the other Sublime goodies btw!
    Last edited by mydingefnysen; 03-25-2012 at 02:33 PM.



  4. Location
    Spain
    Posts
    172
    JacobPennock please share it!


  5. Posts
    3
    Magnificent! Thanks for sharing these.

    I'd be curious to learn about connecting with unity's mono build system, too.


  6. Posts
    4
    Thanks for making this, awesome


  7. Location
    Albuquerque, NM, United States
    Posts
    100
    Quote Originally Posted by JacobPennock View Post
    I just figured out how to call into unity's mono build system from within sublime text 2, so you can program in sublime and get error reporting back within sublime's console, all without even running the unity editor.

    Comment if you are interesting in knowing how.
    Just discovered sublime today and loving it. Got your plugins and very pleased. How can I kick mono builds? Also got a c# complete that I want to config for unity completion.


  8. Location
    Rome / Niš
    Posts
    1,746
    Jacob thanks, thanks, and thanks again. I'm loving Sublime Text and you're my new hero

    ::::: GOSCURRY - a hard game :::::

    I am DEMIGIANT
    HOTween : a fast, type-safe, and powerful Unity tween engine
    HOTools - HOUnityLibs


  9. Location
    Albuquerque, NM, United States
    Posts
    100
    While waiting for Jacob to continue hooking together Sublime and Unity (especially jumping from errors in Unity to Sublime), I wrote a Sublime plugin that can run MonoDevelop builds. Just install the package and create a sublime project at the root level of the project (where the main .sln file is) and you can run a build from anywhere in that project. mdtools must be on your path.

    https://github.com/rstehwien/Sublime-MonoDevelop

    Works with Unity and normal MonoDevelop projects. At least lets you build, check for errors, and jump to those errors with F4 and Shift+F4. Doesn't provide any runtime integration with Unity though.

    Still trying to get CompleteSharp to work at all for me so I can get code completion.

  10. Super Moderator
    Location
    Great Britain
    Posts
    9,644
    AMAZING! as soon as I get time I shall be doing this. I have none of those features at the moment, just using it as a glorified notepad... it is my fave IDE by far though. Thanks!
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  11. Location
    Rome / Niš
    Posts
    1,746
    Hey, just posted a recap of all the (current) steps to integrate Sublime Text with Unity - mainly for personal use, but someone might find it useful. Here it is.

    P.S. Jacob don't disappear please!

    ::::: GOSCURRY - a hard game :::::

    I am DEMIGIANT
    HOTween : a fast, type-safe, and powerful Unity tween engine
    HOTools - HOUnityLibs


  12. Location
    Albuquerque, NM, United States
    Posts
    100
    Quote Originally Posted by Izitmee View Post
    Hey, just posted a recap of all the (current) steps to integrate Sublime Text with Unity - mainly for personal use, but someone might find it useful. Here it is.
    You might also want to include updating the C# bundle so Ctrl+R works properly. Basically go to the git below and copy the contents of Preferences, Syntaxes, and Snippets over what you have in your C# Package:
    https://github.com/wintermi/csharp-tmbundle

    Got that tip from the link below where you can also find a msbuild buildfile for those of you using visual studio.(where I got the beginnings of my monodevelop build).
    http://shawnoster.com/blog/post/C-an...2-PROTIPS.aspx

    Quote Originally Posted by Izitmee View Post
    P.S. Jacob don't disappear please!
    Ditto


  13. Location
    Rome / Niš
    Posts
    1,746
    Updated. Thanks a lot for the additional tips

    ::::: GOSCURRY - a hard game :::::

    I am DEMIGIANT
    HOTween : a fast, type-safe, and powerful Unity tween engine
    HOTools - HOUnityLibs


  14. Location
    Albuquerque, NM, United States
    Posts
    100
    I was able to get code completion working in sublime using CompleteSharp:
    https://github.com/quarnster/CompleteSharp

    Setup something like the following in your CompleteSharp.sublime-settings
    Code:  
    1. "completesharp_assemblies": [
    2.     "D:\\Program Files (x86)\\Unity\\Editor\\Data\\Managed\\UnityEngine.dll",
    3.     "D:\\Program Files (x86)\\Unity\\Editor\\Data\\Managed\\UnityEditor.dll",
    4.     "D:\\Program Files (x86)\\Unity\\Editor\\Data\\Managed\\nunit.framework.dll",    "D:\\Users\\RES\\Documents\\code\\ArcaneProcedures\\ArcaneProceduresLib\\bin\\Debug\\ArcaneProceduresLib.dll"
    5.     ],

    The first few are unity's (including NUnit) the last is one of my own libs... change paths an add more libs as needed. I had some trouble where system classes wouldn't complete or would cause sublime to go unresponsive. I had both .NET and Mono on my path... think CompleteSharp got confused. Possible you will need to add mscorlib.dll with full path... but at this time I dont (and it could cause unresponsiveness if not same as sublime finds).


  15. Location
    Rome / Niš
    Posts
    1,746
    Yey! Thanks rstehwien

    ::::: GOSCURRY - a hard game :::::

    I am DEMIGIANT
    HOTween : a fast, type-safe, and powerful Unity tween engine
    HOTools - HOUnityLibs


  16. Location
    UK
    Posts
    77
    rstehwien - First off great work, thanks a lot for doing this.

    I've got everything working except being able to build with monodevelop (OSX).

    I've added the mdtool path in the settings file but i'm not sure if i've got everything set correctly?

    Code:  
    1. {
    2. "working_dir": "${project_path:${folder}}",
    3. "cmd": ["/Applications/Unity/MonoDevelop.app/Contents/MacOS/mdtool", "build", "-t:Build"],
    4. "file_regex": "^\\s*(.*\\.cs)\\(([0-9]*)\\,([0-9]*)\\)\\:\\s*(.*)$",
    5. "selector": "source.monodevelop, source.cs"
    6. }

    Thanks again.


  17. Location
    NC, USA
    Posts
    30
    Quote Originally Posted by Izitmee View Post
    P.S. Jacob don't disappear please!
    Hey guys, I have not disappeared. I'm sorry that I have not been as active in this thread as I should have been.
    I've been busy with client work and been traveling some. I am on the unity IRC most days under the name of UnicornForest if you ever are trying to chat with me.

    Quote Originally Posted by rstehwien View Post
    I was able to get code completion working in sublime using CompleteSharp:
    https://github.com/quarnster/CompleteSharp

    Setup something like the following in your CompleteSharp.sublime-settings
    Code:  
    1. "completesharp_assemblies": [
    2.     "D:\\Program Files (x86)\\Unity\\Editor\\Data\\Managed\\UnityEngine.dll",
    3.     "D:\\Program Files (x86)\\Unity\\Editor\\Data\\Managed\\UnityEditor.dll",
    4.     "D:\\Program Files (x86)\\Unity\\Editor\\Data\\Managed\\nunit.framework.dll",    "D:\\Users\\RES\\Documents\\code\\ArcaneProcedures\\ArcaneProceduresLib\\bin\\Debug\\ArcaneProceduresLib.dll"
    5.     ],

    The first few are unity's (including NUnit) the last is one of my own libs... change paths an add more libs as needed. I had some trouble where system classes wouldn't complete or would cause sublime to go unresponsive. I had both .NET and Mono on my path... think CompleteSharp got confused. Possible you will need to add mscorlib.dll with full path... but at this time I dont (and it could cause unresponsiveness if not same as sublime finds).
    These new autocompletes are just awesome! Great work rstehwien. I have been working on a new completes file that added all of Mathf and a couple completes for GetComponet and stuff for working with coroutines but now with this new autocompletes I don't really feel like it is needed.


    As far as piping Unity's complier through to sublime's console. I never released anything because, for one, its not as easy to setup as the other plugins and I don't have a ton of time to provide support for it and I was worried lots of folks would have have trouble getting it to work and I would be bombarded with emails and support questions, secondly I could not really get it working well enough for me to feel very safe using it.

    What I was doing was creating sublime project files that called unity's xbuild (xbuild is mono's version of msbuild) to compile everything instead of calling mdtool. Xbuild lets you inject a custom dll from the command line that gets used to collect the logging output. So I created my custom dll for logging to format the output in a way sublime would like. but that was a little tricky as it seems unity ships with a older version of xbuild and I have to go way back in the msdn reference to find out what functions I need. Also it seems there is a bug in the older version of xbuild that sometimes reports a strange error but its basically meaningless to us using Unity.

    Also even through doing this way I have complete control over what is being feed to sublime I could not get the regrex to work correctly with the multiline output in my first screenshot. I can get it to work if I print all the errors and warnings each to a single line, but it doesn't look as nice, but you can click on the errors to go to the line and step through them with the hotkeys and see the error info in sublime's status bar.

    All of this is windows only as well.

    Anyway if one of you guys want to keep working at it, my project files look like this:
    Code:  
    1. {
    2.     "folders":
    3.     [
    4.         {
    5.             "path": "Assets",
    6.             "file_exclude_patterns": ["*.unity","*.guiskin","*.dll","*.meta" ,"*.prefab" ,"*.anim", "*.physicMaterial", "*.flare" , "*.cubemap" , "*.font" , "*.fontsettings" , "*.renderTexture"]
    7.         }
    8.     ],
    9.     "build_systems":
    10.     [
    11.         {
    12.             "name": "Unity Mono",
    13.             "cmd": ["C:\\Program Files (x86)\\Unity\\Editor\\Data\\Mono\\bin\\xbuild.bat", "${project_path}/${project_base_name}.sln","/noconsolelogger", "/logger:${project_path}\\SublimeUnity\\SublimeLogger.dll"],
    14.             "file_regex": "([^(]*)\\((\\d*),(\\d*)\\)\\s*(.*)"
    15.         }
    16.     ]
    17. }

    Here is a link my compiled logger and a template project file. To try and get it to work unzip the SublimeUnity folder to the root of you unity project, then rename the file MyUnityProject.sublime-project to the name of your project (this all might break if your project has spaces in its name) Then move it outside the SublimeUnity folder and into the root of your project (the folder containing assets and all the .sln files). Open one of you scripts in sublime and hit ctr+B to build and hope it works.

    I've also included the source of my logger dll in case you want to try and mess with it. I've been building it with monodevelop.

    Good luck everyone, and great work on getting a better auto complete solutions then I had going.

    P.S. The nice things about them being project files is you can see and open all the scripts in you unity project through sublime.

    P.P.S Really good luck everyone, I am sorry but I will not likely have a lot of time to try and provide support for this, so use at your own risk. I personally would not use it with production code. If you do have a problem the best way to ask me about it is to find me on the Unity IRC.


  18. Location
    Albuquerque, NM, United States
    Posts
    100
    Quote Originally Posted by Sock Puppet View Post
    rstehwien - First off great work, thanks a lot for doing this.

    I've got everything working except being able to build with monodevelop (OSX).

    I've added the mdtool path in the settings file but i'm not sure if i've got everything set correctly?
    Here is what worked for me... but I don't have Unity installed on my mac machine; the mac is for my day job writing geospatial data visualization apps mainly for the insurance industry (not super exciting but good coworkers and it pays well)
    Code:  
    1. {
    2.     "working_dir": "${project_path:${folder}}",
    3.     "cmd": ["/Applications/MonoDevelop.app/Contents/MacOS/mdtool", "build", "-t:Build"],
    4.     "file_regex": "^\\s*(.*\\.cs)\\(([0-9]*)\\,([0-9]*)\\)\\:\\s*(.*)$",
    5.     "selector": "source.monodevelop, source.cs"
    6. }

    Not really different than yours. Make sure your sublime project file is in the same directory as you .sln file. Also try going to the command line in that folder and running the same command to make sure it works
    Code:  
    1. rstehwien$ /Applications/MonoDevelop.app/Contents/MacOS/mdtool build -t:Build
    Last edited by rstehwien; 06-04-2012 at 08:02 PM.


  19. Location
    UK
    Posts
    77
    I missed "Unity" from the mdtool path for some reason - works now. Thanks!

    Also out of interest is Sublime ever something UT could support officially? I've seen a fair few threads on the forum grumbling about Monodevelop and Sublime is definitely the best alternative I've come across.

Page 1 of 11 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •