Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

As a simple Unity indie dev, Mono and .NET still confuse me. Who is who ? Who does what?

I use Unity with Visual Studio and it's brilliant. But, I'm confused about how exactly .NET, Mono and Unity are related to each other. I have no professional experience in the field, I need some clarifications. Are these statements right or wrong?

  1. .NET framework was not designed to be cross-platform.
  2. The .NET frameWork goal is to design programs in a unified way, and they must all run in a virtual machine.
  3. Mono is an open source version of .NET framework, designed to be cross-platform. Programs built with it can run wherever there is a mono virtual machine.
  4. Programs built with mono framework cannot run or are not fully compatible with the .NET virtual machine.
  5. Unity only uses Mono frameWork, either in editing, building, and running games.
  6. Games built with Unity have embedded mono framework and /or mono virtual machine.
  7. I don't need to have .Net framework for building or running Unity games.
  8. The C# scripts I wrote in Unity are run by a mono virtual machine, before and after build time.
    All the Unity engine public code library is C++ wrapped and are not actually C#, thus they are running on C++ side engine.
  9. The mono framework tools and library are run in-game with a mono virtual machine.
  10. DLL built with .NET framework are not fully compatible with Mono.

So what is my rating? Where am I wrong?
(Please be kind. English is not my first language).

like image 258
bsmall Avatar asked Feb 05 '18 01:02

bsmall


People also ask

Does Unity use .NET or Mono?

Unity uses the open-source . NET platform to ensure that applications you make with Unity can run on a wide variety of different hardware configurations. The . NET platform supports a range of languages and API libraries.

Why does Unity still use Mono?

Unity used Mono as their scripting backend to support cross-platform development. So we can write our game code in one place, and deploy it almost anywhere.

Is Unity based on Mono?

Unity Technologies Implements Award-Winning 3D Game Development System Using Mono. Unity Technologies, based in Copenhagen, Denmark, is the creator of the product Unity, a game development system built around their own powerful 3D engine.

Which .NET does Unity use?

NET Framework, because before Unity 2017.1, Unity has been using a . NET 3.5 equivalent scripting runtime, missing years of updates. With the release of Unity 2017.1, Unity introduced an experimental version of its scripting runtime upgraded to a . NET 4.6, C# 6.0 compatible version.


1 Answers

  1. .Net frameWork was not designed to be cross plateform.

Depends on whether you wish to include say Linux in that. If you are asking if .NET was originally designed to target Linux then, no. However there is the .NET Compact Framework which allowed .NET code to run the Xbox 360 and Windows Phone.

There is now .NET Core, a free and open source framework which is designed for cross platform, specifically Windows, Mac and Linux.

  1. The .Net frameWork goal is to design programs in a unified way, and they must all run and a virtual machine.

Yes. The correct term is Execution Engine by the way not VM though they both are in the same class. Don't think of the EE as something akin to vmWare where CPU instructions are constantly emulated. .NET like Java and are a form of p-code however .NET assemblies are JIT'd to the current CPU so as to improve performance and run natively on the CPU. [1]

  1. Mono is an open source version of .Net frameWork, designed to be cross plateform. Programs built with it can run wherever there is a mono virtual machine.

Yes. .NET Core has the same claims. [4]

  1. Programs built with mono frameWork can not run, or are not fully compatible with .Net virtual machine.

The Mono Framework across it's many versions is not a 1:1 of the equivalent .NET Framework.

e.g.

  • Mono has no support for WPF in .NET 3.0 [2]
  • Mono has no support for WWF in .NET 3.0 [2]
  • Mono has no support for CodeContracts in .NET 4.0 [2]
  1. Unity only use Mono frameWork, either in editing, building and running games.

Incorrect. Unity also uses Unity Script for composing a game.

However there is a big difference for runtime irrespective of your language choice. When targeting say a web browser via Unity Web Player, there is no .NET/Mono EE. The platform is the Unity Web Player. In this sense .NET/Mono is not required on the target platform. [3]

  1. Games built with Unity have embeded mono framework and /or mono virtual machine.

Incorrect, see above

  1. I don't need to have .Net frameWork for building or running Unity games.

Correct

  1. The C# scripts i wrote in Unity are run by a mono virtual machine, before and after build time. All the Unity engine public code library is c++ wrapped and are not actually C#, thus they are running on c++ side engine.

Incorrect, there is no correlation between what language you choose to use to write your Unity game in and whether or not the .NET/Mono EE is present at runtime.

  1. The mono frameWork tools and library are run in game with a mono virtual machine.

Depends.

  • On your desktop whilst running the Unity Editor? - Yes
  • Deployed at running on a smartdevice/browser? - no
  1. Dll built with .Net frameWork are not fully compatible with mono.

Incorrect. It is Mono that may or may not be fully compatible with the equivalent .NET Framework. [2]

See also

1 "Is the CLR a Virtual Machine?", MSDN

2 Compatibility, Mono

3 How does the Unity Web Player work?, Quora

4 .NET Core Framework - Go Cross-Platform with the .NET Framework, MSDN

like image 99
MickyD Avatar answered Sep 22 '22 18:09

MickyD