Grilled. NET,. NET Framework, mono, and unity

Source: Internet
Author: User
Tags unity 5

ZhaichaoTags:. frameworkc#monounity2017-04-23 14:39 425 people read comments (0) favorite reports

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The Unity project has been around for more than a year, knowing that Unity uses mono for cross-platform, but the. NET. NET Framework and mono have been just smattering. Recently working on a Unity project requires the dynamic loading of scenes and scripts from the outside, and then a closer look at the. NET Framework and Mono, and here's a little summary. But the level is limited, if has the mistake to beg lightly sprays. First look at the home page of the. NET core project on GitHub, Let's take a look at what the. NET is for: you can see a few sub-items under this homepage, several of which look familiar, such as CORECLR, not the CLR virtual machine, CORELX, see description like the FCL, CLI, the familiar common language infrastructure, plus a standard project, It's about. NET Standard, and there's a document about standard version in the standard project: In addition, the following is described in the standard project's Readme: So you can summarize it. NET from an abstraction is actually a concept, even if a program written in multiple languages can run on different operating systems and hardware platforms through a common runtime. But there is no idea, it needs to be realized, and we're going to call it a. NET platform for some implementations of. NET, such as the. NET Framework, which is implemented on Windows, is a cross-platform Platform). A. Net Platform want to achieve the goal of. NET, need some components, such as the CLR common language runtime, such as the FCL base Class library, such as the various languages of the compiler, compiler compiled things to be able to run in the CLR, that also need to follow a certain standard, which is the CLI and cil,cil rules for compiling output, The CLI specifies the rules of the compiler input language, and only languages that conform to this standard can be compiled into the CIL language running in the CLR. Okay, now with CIL and CLR, programmers can write programs in a CLI-compliant language such as C #, compile them into CIL, and then run them in the CLR. But the problem comes, programmers need to develop a program to use a number of features and data structure, not all of the functionality of the details of their own implementation, or the development costs are too high, so you need to provide some basic library, convenient for programmers to develop, then need to provide which basic library? This also requires a standard, and. NET standards is used for this purpose, which specifies which APIs a. NET platform needs to provide to the developer. In this case, join a developer in the. NetA project is developed on platform A (such as the. NET Framework) and then you want to migrate to. NET platform B (for example, mono), so that as long as two platform implement the same. Net Standard then the source code can be directly compiled and run without modification. However, if I have a machine that has. NET platform a (such as. NET Framework) and. NET platform B (such as mono), can I run a. NET program that I compiled on A to B? Theoretically it should be fine, after all, CIL is unified, although one is A's CLR and the CLR of B, but they are all used to process CIL programs, just as Java code compiles to run on the JVM or run on Delvik. However, not necessarily, because CIL itself is not immutable, it also has its own version, see the following document: Https:// The table in detail explains the. Net The relationship between the framework and the CLR version, using the CLR 2.0,.net Framework 4.0 from the. NET Framework 2.0 through 3.5, is CLR 4.0, with no CLR 3.0 version in the middle. This also means that the CIL language itself is changing, and that programs that are compiled for CLR 4.0 naturally cannot run on CLR 2.0. Say, what exactly is the. NET Framework? Personal understanding the. NET Framework is an abstraction from a set of implementations on the Windows platform for the. NET Standard, which specifically includes the Cli,cil,.net standard, in particular, the. NET Framework contains a complete suite of solutions, Contains many word components, such as compilers, CLR, FCL, and so on, each of which has its own version, such as the compiler has its own version to adapt to different versions of the language, such as the. NET Framework 3.5 compiler only support to C # 3.0, the latest has been to C # 7.0 Each version of the. NET Framework provides a growing range of FCL, such as System.Linq to. NET Framework 3.5, and the CLR version will be different, as has been said before. Therefore, the version of the. NET Framework is actually a collection of its component versions, and each sub-component in the later. NET Framework has a certain version update. In fact, normally. NET frameWork is just a set of implementations of the. NET Standard, and other implementations of the. NET standard can combine different versions of the components, such as my. NET platform provides the. NET Framework 4.0 FCL and the compiler for C # 6.0. But with the CLR 2.0 runtime, that's fine, as long as the compiler and runtime match (that's what mono does). However, because. NET is Microsoft's proposed and the. NET Framework is developed by Microsoft, the. NET Framework is the benchmark for the platform implementation, and each version of the. NET Framework provides some new features. Support for the. NET Framework x.x means that this. NET platform implements the features of the x.x version of the. NET Framework, such as the following documents on the Mono home page:  
You can see that. NET 4.6 4.5, which is actually the. NET Framework, which means that the latest version of Mono has implemented the features in the. NET Framework 4.6 that support C # 6, as well as the ability to discover only. Net 3.5 and 2.0 are mono that fully implements all of its features. The exact fact is that mono implements most of the feature of the. NET Framework and also provides some mono's own class library. There is roughly one correspondence between the mono and the. NET Framework, as this article says: HTML This table does not seem to be quite correct, Mono 2.0 implements the System.Linq component, which is provided in. NET 3.5, so mono 2.0 corresponds to. NET 2.0/3.5, which is the sum of the two. But it can still be used as a reference. So adding an assembly is built with the. NET Framework 3.5, Referring to some DLLs such as System.core and System.Linq, then to import it into the Mono project, you must ensure that the version of Mono is above 2.0, otherwise the corresponding reference will not be found. It is also important to note that many of the online versions of the. NET Framework version and CLR version are confused, and sometimes the term ". NET 2.0" refers to the fact that CLR 2.0. Others mistook System.Environment.Version for the. NE framework version, which is not, in fact, very clear on MSDN, which refers to the version of the CLR: it's also worth noting that building a. NET in VS In the Framework 3.5 project, the referenced System.dll is in the system's. NET v2.0 directory, which means that the. NET Framework is not independent, but rather relies on the. NET Framework 2.0. However. Net The version after 4.0 is not like this, each time the new version is independent.
Finally, let's talk about unity,unity. For cross-platform use of mono, the mono version used can be obtained either by code or command line, and a cow has been explained in Unity Forum: questions/259448/how-to-determine-mono-version-of-unity-.html my own test results are mono 2.0. Mono, mono 2.0 is the 08 vintage (unity is still in use, seems to be a copyright issue, did not delve into), and with VS open the script in unity, look at the project build file. csproj: You can see that unity uses. Net 3.5, so is Unity's script built with the. NET Framework 3.5? Obviously not. We know that VS has a thing called Vstu, and its biggest function is to debug unity Editor with the breakpoint Debug feature of VS. A script in unity builds a VSTU project when it is opened in vs. Although the VSTU project looks very much like the normal Vs project, the VSTU project is not really a real vs project in nature, if you right-click the project----the property is unresponsive (VSTU 2.1 has reacted before and then disabled), and the references in the right-click Project will not have the Add Reference option. In fact, Vstu is a powerful editor for vs. But Vstu is not just using vs for syntax checking, it's another function of debugging breakpoints. In the absence of breakpoint debugging, unity compiles with its own compiler, generates Assembly-csharp.dll (in the/library/directory), and clicks the play button with this DLL. When using vs for Breakpoint debugging, the Assembly-csharp.dll and PDB files are compiled with the VS compiler, and in the \temp\unityvs_obj\debug\ directory, this DLL is used to click Play. Of course, the build out of the EXE when the use of their own compiler. Vstu limits the project and cannot add new DLLs directly to VS, but can be copied to the asset directory of the Unity project, so unity will reconstruct the VSTU project and display the copied DLL in the reference list. The project built by Vstu is based on the. NET Framework 3.5. Because Unity uses Mono 2.0 Ah, the feature implemented by Mono 2.0 includes the. NET Framework 2.0 and 3.5, while UnityEngine.dll references the SYStem. Core.dll, and this DLL is in the. NET Framework 3.5, if it is built on the. NET Framework 2.0, then the first few Mono 2.0 supported feature will not be found in VS, also cannot be breakpoint debugging, Because the compilation pass. In fact, you can also look for some clues in Unity's installation directory, under Windows: C:\Program files\unity\editor\data\mono\lib\mono\ 2.0 This Directory 2.0 visual is the version of Mono, there are many DLLs in the directory, such as System.*.dll, which shows that unity has its own mono project, providing the basic class library implemented in Mono 2.0. While Unity's scripts can be opened in the same way as VS and Monodeveloper, the build is built with a compiler in mono from unity, while Mono 2.0 supports only C # 3.0, so some of the newest grammars are not compiled in unity (Unity 5.3.5 P8 provides a new compiler for mono 4.4 for testing, but it does not seem to be the context below). To summarize, Unity uses mono 2.0, supports C # 3.0, and provides a class library that is compatible with the. NET Framework 3.5/2.0 API (Mono 2.0 implements the. NET Framework 2.0 + 3.5 feature, However, the feature of the. NET Framework 3.0 WPF is not implemented, so the official statement is . Net 2.0/3.5 Framework Profile), using a mono runtime that is compatible with the CLR 2.0, so that using vs to build Unity's DLLs requires the. NET Framework 3.5 below, otherwise runtime is incompatible, and if you want to use unity like unityengine, you must use. Net Framework 3.5 This version, otherwise the VS project cannot find System.Core.dll, cannot compile, if just some tool class, do not need to reference UnityEngine.dll, then build with. NET Framework 2.0 is possible. VS is just a third-party build tool that wants to build a DLL that unity can use without the feature that Unity (Mono 2.0) does not support.
One last thing that's been bothering me before, but today is a little bit more figured out that Unity's player setting has an API Compability level: There's only two options:. NET 2.0 and. NET 2.0 Subnet, This is very confusing to tell the truth, literally refers to API compatibility, that compatibility to. NET 2.0 is compatible with the. NET Framework 2.0 FCL API? But unity can use some of the libraries of the. NET Framework 3.5. I found one online. The following URL: Monocompatibility.html and this question: One of the words is key: The 2.0 there is likely a good reflection of what you had at leastSo the comb is that. NET 2.0 and. NET 2.0 subnet are different from the set of functions written by C # code that can be referenced, and if subset is selected then the DLL will not be imported into the project. For example, a directory built with. NET 2.0 and. NET 2.0 subnet for the same project can clearly see the difference between the two.
When you create a new unity project, only some of the core DLLs will be imported into the project, the other DLLs need to be copied from the external to the project's asset folder, Vstu Project can not be directly added to the reference, the personal feel vstu a little more restrictions on the project, like the developer as a fool, Because you're using unity then these functions will be disabled for you, but visual inspection can be done by modifying the. sln or. csproj files to achieve some special needs. What about the. NET Framework 3.5? In fact, unity supports the. NET Framework 2.0 + 3.5, skipping 3.0, because 3.0 is WPF, unity does not, and. NET 2.0 refers to at least what feature you can use. Unity recently joined the. NET Foundation with several beta versions of the latest mono: Upgraded-mono-net-in-editor-on-5-5-0b4.433541/unity 5.5.0 b4 inside the API compability level adds a 4.6 option, in fact, the original Mono 2.0 is changed to Mono 4.6 For testing, Mono 4.6 supports C # 6.0, and developers can write programs using the. NET 4.6 API, but they don't know when the stable version will be available. And mono is about to be eliminated, after the visual inspection is il2cpp.

Grilled. NET,. NET Framework, mono, and unity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.