Manual Compilation of C Sharp Unity Scripts

From Unify Community Wiki
Jump to: navigation, search

Contents

Requirements

  • Mono
  • Unity

Compilation on Mac OS

To compile all C# Unity scripts in the current dir and all subdirectories, run:

 gmcs -recurse:'*.cs'
      -lib:/Applications/Unity/Unity.app/Contents/Frameworks/
      -lib:/Applications/Unity/Unity.app/Contents/Frameworks/Mono.framework/
      -r:UnityEngine -r:UnityEditor -r:Boo.Lang
      -nowarn:0169 -target:module

Note that Unity still has to compile the scripts, but compile-time errors can be detected without Unity.

Example Usage

Vim Integration

When the gmcs.vim compiler script is installed, you can configure vim to automatically compile and Quickfix errors:

:compiler! gmcs
:set mp=gmcs\ -recurse:*.cs\ -lib:/Applications/Unity/Unity.app/Contents/Frameworks/\ -lib:/Applications/Unity/Unity.app/Contents/Frameworks/Mono.framework/\ -r:UnityEngine\ -r:UnityEditor\ -r:Boo.Lang\ -nowarn:0169\ -target:module
:set autowrite

Thus, you can just run

:make

and use

:copen
:cnext
:cprevious

for browsing errors

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Tools