Unityscript or C#

I downloaded several iPhone examples and found all of them using UnityScript not C#. Is there any reason or should I avoid using C# for iPhone/Android games?

The reason is that UnityScript is basically the “unity specific language”, also anyone capable of C# will not have any problem understanding UnitySCript (the opposite does not hold)

normally you would want to prefer C# over UnityScript as there are things only available to it like binding plugins or offering code available to all languages (unityscript code can not be accessed by c# independent of the compilation order). Also, UnityScript requires additional binaries to be present (boo) which c# does not need

Plus you’ll find a lot more resources (tutorials etc) on C#. Well, the Unity-specific tutorials might be in UnityScript, but there are a lot more C# programmers in the world.
It’s also a better skill to have outside of Unity.
If it was ECMA-standard javascript, it would be a little different.
(Not bashing UnityScript, I’m sure it’s a nice language, I just really like C#.)

So is it no performance difference between those lamguage?

Generally not. Currently I use C# for “library”-type code that needs specific features that UnityScript doesn’t have, and UnityScript for all game code, since IMO C# has numerous irritations that UnityScript lacks. I never understood the “used more outside Unity” argument…I don’t care about anything outside Unity when I’m using Unity, I’m spending hours hours programming inside Unity, so I want the path of least resistance when doing so. When I’m not using Unity I’ll obviously use something other than UnityScript, no big deal.

However, Unity 3 adds a number of “C#” features to UnityScript, so I expect I’ll be using even less actual C#. On the flip side, Unity 3 also upgrades C# to a newer version that has type inference among other things, but I still think it’s too annoying. :wink:

I might also note there are already, what, dozens of threads on this subject…

–Eric

Sure, learning different languages is no big deal. I just find it convenient that I could write a, let’s say, monotouch app in the same language as a Unity game.

As for the irritations, for me being able to use code completion etc (using monodevelop) far outweigh these. Even though monodevelop is a bit on the slow side on my low-end macbook.

Off course, to each his own :slight_smile:

Damn, someone who thinks the same here :slight_smile: I don’t like C# and I prefer to use unityscript, using the .net 2.1 in unity 1.7 only adds a lot of mg to the build with nothing interesting in return (for me of course)

Well, that doesn’t really have anything to do with C# vs UnityScript though. e.g., it’s easier to use something like WriteAllBytes in 2.1 instead of having to manually implement it. Because .net is .net regardless of language.

–Eric

You’re right, but using C# and the “special” features means the use of .net 2.1 wich add and extra charge to the build, for me another reason to avoid C# for now

Is that mean if I use C# then the final build size will be larger? That sounds really bad to me.

My understanding is the .Net framework comes for the ride regardless of you using C# or not. So basically using Unityscript does not save any space.

No. If you use JS the build size will be larger, because there are some libraries it needs that C# doesn’t use. (How much larger depends on the stripping level…if you use max stripping it’s hardly anything.) You don’t have to use .net 2.1; it doesn’t matter if you use C# or JS.

–Eric

I have to agree here, I use C# for reusable library/framework stuff and unityscript for gameplay ‘glue’. Less typing, means I can fail faster.

as much as UnityScript learnt from C#, its important to not forget that C# itself also was upgraded to C# 3.5 and now has the majority of the UnityScript benefits + its own ones too.

for example you can now also use var blabla = new SomeBlah(); in C# without a problem :slight_smile:

difference is just that C# can also use LINQ etc, where as UnityScript is closing in to where C# was with unity 2 / iphone 1.x already.

and some tend to forget that the addition of the new features on UnityScript also has cut some automagic