D
D
Daniel Demidko2018-06-30 10:33:22
.NET
Daniel Demidko, 2018-06-30 10:33:22

How is Unity related to C# and .NET?

How is Unity related to C# and .NET?
I see two options.
The first is that some part of Unity is responsible for the operation of the executable file. C# code works like its scripts, part of Unity calls them and interprets them internally.
The second is that our assembled C# code is responsible for the operation of the executable file, and Unity, as it were, is its library. About the same as Java + Android SDK. It's just that the Main method is hidden somewhere inside.
Which option is closer to the truth?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2018-06-30
@DanielDemidko

With .NET - no way. Mono is there.
With c# - everything is more complicated. You describe program logic in C# using the Mono libraries (System) and the Unity libraries (UnityEngine). Further, this whole thing is compiled into IL. And then - depending on the platform. Maybe it will be executed right away (the interpreter is built into Unity, most likely based on Mono), or it can be further translated into cpp and compiled already as plus code.

C
ColdSpirit, 2018-06-30
@ColdSpirit

Second. It looks like the basis of a unity application is the executable that runs our scripts, and the libraries that our scripts access. By the way, our scripts are not scripts at all, but quite already compiled and packaged code. And the unit manages all these "scripts" using Mono , which is also included in the build.
For example, here is a screenshot from a typical build on Windows:
a3ed6bfdf496d2a505aa89ab7114879a.pngOn the picture you can see the proprietary launcher from the unit, the library for its operation in this system (for browsers, for example, Unity Player is installed as an extension), and game_Data is a directory that includes other necessary libraries (for physics and UI), assets, including our scripts, as well as the Mono libraries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question