Unity Community

Register or Sign In:

+ Reply to Thread
Results 1 to 2 of 2

  1. Posts
    11

    Setting Compiler Options

    Hello, I'm new to Unity, so maybe you guys could help me get some issues off of the ground. This is all C#.

    In order to use an existing library I have, I believe I need to modify compiler settings to accomplish two goals:

    -Enabling use of unsafe. At the points where my code uses 'unsafe,' I get the error "Unsafe code requires the 'unsafe' command line option to be specified."

    -Enabling use of System.Linq. Is there a way to do this, or is this not supported? "The type or namespace name 'Linq' does not exist in the namespace 'System'.

    I have tried modifying compile_any.pl, based on what I read elsewhere in the forums. In particular, in the region
    # Run the csharp compiler

    I added '-unsafe' and '-langversion:linq' to @base_args.

    This did nothing. I later got rid of the file compile_any.pl altogether (or rather, renamed it to compile_any2.pl) and it still doesnt make a difference, it compiles just as it used to.

    I have indeed modified and re-saved the files to make sure they are compiling, and it appears that they are. So maybe I'm modifying the wrong file?

    The one I have was found in, with my directory structure:
    C:\Program Files\Unity\Editor\Data\MonoCompiler.framework\com pile_any.pl

    If it matters, Unity 2.6.1f3, Pro.

    Thanks!

  2. Mat Mat is offline

    Location
    Strasbourg, France
    Posts
    30

    Re: Setting Compiler Options

    Quote Originally Posted by DarkOmega
    -Enabling use of System.Linq. Is there a way to do this, or is this not supported? "The type or namespace name 'Linq' does not exist in the namespace 'System'.
    Hello, I too am very interested in this but this is likely to be delayed until Unity upgrades to a newer version of the Mono libs.

    There is a workaround though, check this: http://answers.unity3d.com/questions...in-c/1315#1315 .