Initiative: Red Dawn

May 24, 2016

Spell Run – Language: c# or Javascript?

The first decision to make in Unity (if you haven’t pre-decided yet) is on which language I want to script on between C# or UnityScript (a.k.a. Javascript). To make such decision, I consider a few things that may or may not be the same in your case, but may help you decide which language to use or which language to learn if you are starting from scratch. In my case, I prefer to use C# for a variety of reasons I’ll expose below, but you should do your own math and decide what’s best for you. Because this is all based on my experience. My comfort zone The first and most important factor is preference and/or knowledge. If you know more Javascript (JS from now on), then by all means code in JS. If you know or like C# better, then use that! Most likely for the game you are trying to do, any language performance differences will not affect the outcome of your game not even by a tenth of a frame, but any coding speed difference definitely will. I love JS. Trust me, I do. But in Unity (you’ll see below why), I prefer C#. Libraries I always decide what to code base on libraries I use, both my own or third party. Since I have a lot of scripts already made in C# from my past projects, and most of the libraries I use from third party are written in C# (Facebook SDK, Unity IAP, etc.), I choose it for better compatibility. The order of the factors affect the product JS and C# in Unity have different compiling time. This means they are not compiled together. Because of that, if you want a JS script to access a C# script, you have to follow specific folder guidelines to achieve that. I’ve found myself in a hybrid nightmare of C# and JS scripts that didn’t see each other, so I had to arrange some on the Assets folder, some on Standard Assets, some on Plugins, etc. to be able to achieve what I wanted. Since then, I chosen to use C# for everything. It’s not real Javascript Unity’s Javascript is not really Javascript. In fact, it’s actually UnityScript and it lacks a few of the most powerful things Javascript has (for my taste), which is JSON. You can see a more detailed list of the differences here as well, but I’ve found several that make UnityScript a turndown for me. I develop a lot in JS (NodeJS and AngularJS for example), and I absolutely love JS. But when it comes to Unity, I go with C#. For those factors, I always been coding in C# when using Unity, and already ported back all of my JS libraries to C#. Now that we got that out of the way, let’s jump to the next order of business. Don’t forget to follow us on twitter for news regarding articles and game development [twitter-follow screen_name=’indelvestudios’]


  1. Spell Run – The backstage of a game – Indelve
    June 30, 2016 @ 1:01 pm

    […] Language: c# or Javascript? […]


  2. Spell Run – The Idea – Indelve
    June 30, 2016 @ 1:04 pm

    […] So, let’s start making decisions! […]


Leave a Reply