that differences don’t exist. you can’t build unity from MS C# compiler (VS can only be used as coding editor, not more).
You can build additional .net assemblies there and use your own compiler directives naturally but those don’t touch unity nor vice versa.
that differences don't exist. you can't build unity from MS C# compiler (VS can only be used as coding editor, not more).
You can build additional .net assemblies there and use your own compiler directives naturally but those don't touch unity nor vice versa.
There is definitely difference between targeting the Mono runtime and the MS runtime in builds. First of all, C# 3.0 does not work, so I cannot use extension methods, automatic properties, LINQ and some other things, second, many types are gone.
If you drop MS-built DLL:s into the Asset folder, they will target the Mono runtime, as type gets resolved on compilation. The consequence could be quite different.
I am already building multiple DLL assemblies using MS C# compiler and this runs 100% fine in Unity web/desktop builds. I build them in VS. I am keeping the Unity code editing within Unity/Scite to a minimum to remain productive. And I want to reuse source files in these assemblies in projects targeting ASP.NET, Compact Framework. This is already possible to do and I have done it. But I want to change the compiler directives “globally” for the Mono build, inside Unity, so that the Mono compiler can skip/include specific source lines.
Note that I am absolutely not trying to build the project/solution that is the “integration project” auto-generated by the Unity editor. This solution is (as understood) supported for IDE integration only. I have >10 VS projects which are standalone from the integration solution which then merges on the player build.
An example of what I wish to do is below. Since Unity is based on C# 2.0 we cannot use automatic properties, so the same property could be refactored as such, while still reusing the same source file. It is quite beautiful because it will eliminate a lot of very ugly copy-paste duplication for existing sources.
#if UNITY_BUILD
private String _name;
public String Name
{
get { return _name; }
set { _name = value;
}
#else
public String Name { get; set; }
#endif
That way there naturally is a difference.
What I meant is that Unity always compiles with unity and does not care nor support MS .NET (which can become especially tricky if you are using stuff thats pure MS .NET only). At the time an additional hurdle is Mono 1.2.5 (which is primarily .NET 2.0 only with some higher stuff cut or only partially present which will become especially troublesome in web related stuff as you will likely find out)
Though independent of that I don’t see how a compiler directive relates to unity.
Its of importance for your solution that generates the unity usable .net assembly, but not for unity.
mono is used because they are loaded and executed within the mono environment, not within a MS .NET environment.
I’m pretty sure you could add own defines by adding them to the @defines array thats used for the compilation
the only case where anything related to compiler args etc was talked about in the past I think was in relation to the -unsafe flag