Search Unity

Why C#?

Discussion in 'Scripting' started by marty, May 11, 2005.

  1. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    I'm curious as to why Unity is scripted in C#?

    I mean, Unity is clearly all about cross-platform-ness and Mac-based-ness, yet C# is virtually proprietary to .NET. Not many Mac developers use C#, in fact, not many non-.Net programmers use it.

    I know it's a tiny jump to learn C# if you already know any ECMA-based language (i.e. C++, Java, JavaScript, even ActionScript) and I don't mind using C# - I'm just curious as to what advantages led you folks to choose it over the (arguably more familiar) alternatives.
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Unity 1.0 will support the following languages:
    * Javascript
    * Boo (A python like language)
    * C#

    Beta 5 supports boo already. (Assets/Add Boo Script)

    Java script support will be added during one of the next beta versions.

    There are several reasons for using .net

    1) Language interoperability
    You can use several programming languages, and they can communicate with each other. Eg. Boo scripts can call C# scripts.
    We want to give people the option to use the scripting language they are most comfortable with.

    2) Speed
    Using the .net runtime we get a jit compiled scripting language that is insanely fast. The speed of C# for example is around half the speed of c. And it will become only better.

    This allows us to do heavy processing in the scripting language.
    So you can use the scripting language to write real algorithms.
     
  3. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    I'm glad to hear that JavaScript will be in the mix. I think a lot more people know it right now, especially on the Mac side.

    It sounds like the best performance results will come from scripting C# though, correct? No biggie, just want to make sure I use the best one! ;-)
     
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You won't really notice the speed difference between C# and javascript.

    Javascript will be very nice because it cuts down the script size a lot you can actually write meaningful single line scripts then. Javascript will not be very robust during the beta because it is in development right now and hasn't been tested as much as the other languages.
     
  5. superman327

    superman327

    Joined:
    Nov 29, 2011
    Posts:
    67
    Holy crap, the previous poster is the CTO, from when Unity was young :)
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    There's thread necro and then there's this. It's only 6 years it's been buried. Superman obviously used his xray eyes to figure out where it was buried.
     
  7. Dabeh

    Dabeh

    Joined:
    Oct 26, 2011
    Posts:
    1,614
     
  8. Fenrisul

    Fenrisul

    Joined:
    Jan 2, 2010
    Posts:
    618