To my knowledge, thus far, I have thought that C# is and has always been a compiled language. I have recently started studying Unity3d and noticed that they give C# as an option for scripting and interacting with game objects through their API (along with JavaScript and a couple of other alternatives).

How is this done? Is C# actually being executed or is this an abstraction that is being converted to a different scripting language under the covers? It seems to me that there is some sort of interpretation going on for this functionality.

  • 2
    \$\begingroup\$ What are scripting languages? \$\endgroup\$
    – jcora
    Mar 19, 2013 at 20:18
  • \$\begingroup\$ en.wikipedia.org/wiki/Category:Scripting_languages languages interpreted at runtime rather than compile time. \$\endgroup\$ Mar 19, 2013 at 20:20
  • 2
    \$\begingroup\$ But JavaScript is compiled before being executed 99% of the time, and some Python implementations too. C(++) can be interpreted. I think that the terminology is flawed, as you're not talking about a property of the language, but the way you use it. But it seems that's not really important for the question... \$\endgroup\$
    – jcora
    Mar 19, 2013 at 20:25
  • \$\begingroup\$ "compiled" or "scripted" is not the property of programming language. When you are implementing the language specification, you can decide whether you want to "compile" it or "interpret" it. \$\endgroup\$ Mar 19, 2013 at 20:26
  • 1
    \$\begingroup\$ That being said, what I have always interpreted as a "scripting language" is the basis of this definition. Perhaps the vocab should have been "interpreted" but I have always seen them one in the same. webopedia.com/TERM/S/scripting_language.html \$\endgroup\$ Mar 19, 2013 at 21:59

3 Answers 3


Unity is using Mono behind the scenes. Every time you make a change to your C#/UnityScript scripts it recompiles the code almost instantly.

If you look in the data directory of a standalone unity player, you can see it has compiled all the scripts into Assembly-CSharp.dll, or similar.

So yes, the C# is being compiled.

  • \$\begingroup\$ Ah I see the .dll now in the data directory. This clears things up. \$\endgroup\$ Mar 19, 2013 at 20:22
  • 6
    \$\begingroup\$ +1 for actually answering the question and not turning it into a pompous semantic arm-wrestling match \$\endgroup\$ Mar 20, 2013 at 10:35
  • 1
    \$\begingroup\$ @BrandonClapp if this answer solved your question, please mark it as correct. \$\endgroup\$
    – petervaz
    Mar 20, 2013 at 18:12
  • 1
    \$\begingroup\$ Sorry for reviving this, but how does Unity handle the loading and unloading of the compiled DLL in the editor? Or should I start a new question? \$\endgroup\$
    – Jeff
    Sep 4, 2014 at 15:51

C# is an object oriented programming language - it needs to be compiled before ran. Just because it is widely used in Unity3d, don't let its ease and flexibility fool you.

  • 1
    \$\begingroup\$ So because it is object oriented, it needs to be compiled? \$\endgroup\$
    – Vaillancourt
    Aug 23, 2021 at 21:01
  • 1
    \$\begingroup\$ No, not because it's a OOP. It needs to be compiled because it's a programming language. Script languages do not require to be compiled and are used in a runtime environment. In the context of Unity, back in Unity 2.0 Javascript was able to ran and changed during runtime. I don't think that functionality exists anymore. \$\endgroup\$ Aug 24, 2021 at 22:15

First, scripting languages are not necessarily interpreted languages. Some scripting languages such as Lua and Python can be either JIT-compiled or interpreted.

And, as for the question itself: because C# is a scripting language, but Microsoft does a good job on making it not look as such.

C# has everything a scripting language needs: dynamic typing, JIT-compiling rather than static compiling, runs in a virtual machine...


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .