|
created Scripting: Javascript, C#, or Boo
on 02-16-2012 10:08 PM
I was curious who uses what for scripting: Javascript (or UnityScript since it's not exactly JS), C#, or Boo. - LW3
|
, null,
18 Posts,
Join Date Feb 2012,
Location USA
|
I use javascript, but i'm not a programmer or anything. I also came in with some prior experience with javascript, back when the entire documentation was all in js. There is some functionality missing from js that C# has and boo might have(?). Practically no one seems to use boo though, so it's a bit harder to find support and snippets.
C# is probably the "best" language, since that's what everything ends up as internally anyway, but javascript is probably easier to pick up.
|
, triangle,
296 Posts,
Join Date Oct 2008,
Location gbg sweden
|
I was pumped to use C#, but after trying to get stuff done quickly and seeing a ton of JS examples, I've only been using. I think I'll switch for my next project though.
"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Portfolio
|
, polygon,
660 Posts,
Join Date Feb 2009,
Location Michigan
|
I used to use Unityscript but now I would definitely recommend C#. Unityscript might be slightly easier to learn but the only advantage it has is dynamic typing. You can pretty much do dynamic typing in C# too by casting to Object. C# also has some really nice features that Unityscript doesnt like variable accessors (get and set functions for variables).
Also the intellisense thingy for MonoDevelop doesnt work very well with Unityscript.
Last edited by commander_keen; 02-17-2012 at 01:15 AM..
|
, polygon,
618 Posts,
Join Date Jan 2005,
Location Los Gatos, CA
|
actually i use boo as i was more used to the python like syntax, worked out pretty good so far. as not many seem using it, its a bit sad that there is not so much ready to use code around, but most of the time its quite easy to convert from c# to boo.
im thinking about switchting back to c# - but im quite happy for now with boo.
|
, triangle,
324 Posts,
Join Date May 2008,
Location berlin
|
C#! 
|
, triangle,
287 Posts,
Join Date Apr 2009,
Location South Africa
|
C#! Very clean language and very easy to learn. And then there's this badass stuff like events and delegates, LINQ, Generics (although you can use those as well in UScript I think), etc...
|
, polycounter,
954 Posts,
Join Date Mar 2011,
Location Nottingham, United Kingdom
|
I've been using UnityScript (JavaScript) for my stuff but I kinda wish I'd started with C# - there's lots more examples of regular C# code around the place that you can use.
I find the US syntax a lot simpler, though.
|
, dedicated polycounter,
1,432 Posts,
Join Date Mar 2007,
Location Leeds (UK)
|
I've been using unityscript as well because I already had experience in javascript. I also like the speed and that I don't have to be very strict and can be a bit messy :p. If I would switch to C#, what would be the big wins? I've been trying to figure that out, I guess I just need to try it.
|
, polycounter,
963 Posts,
Join Date May 2006,
Location Stockholm
|
@ Talon: C# isn't all that different imho. Especially if you have a background in C or Javascript. I always thought of it as a type-safe version of Javascript.
Granted, some of the LINQ and Lambda syntax can be a bit daunting, but you get used to it.
Speed-wise, uscript scripts compile to a mono/.NET assembly, and so do the C# scripts, so I reckon performance will be pretty much equal. Although I have never really tested this. So don't take my word for it.
For me personally, C# leverages you to be more considerate about what you write, how you use it and when. Due it's much less forgiving nature then Unityscript. I think this holds you somewhat back from getting super messy code really fast, although that entirely depends on the person. I myself am very prone to write messy code so I prefer statically typed languages because it makes me think before I put something down.
There's also the much better access to delegates, generics, reflection and most importantly events. The latter is VERY important for game dev imho. Especially in a component driven model such as Unity where dependencies can become a real hurdle.
And if you tend to use SendMessage a lot, it's actually a good idea to start checking out .NET type events. As SendMessage uses Reflection, which is a bad idea if you're pushing a lot of those to a lot of GameObjects all the time.
You can also use the more traditional OO methods of abstract classes, interfaces, virtuals, statics, etc...
And then there's also the tools. I absolutely despise MonoDevelop because it makes my poor little macbook slow down to a grinding halt, but Visual Studio (Express) is an absolute godsend. But that's a personal preference, what is important is that you have auto completion so you don't need to constantly have the docs on hand to see what a particular method is called, what parameters it takes and what it returns. And the auto error checking is an absolute must if you want to be productive. The time I've lost fixing Javascript syntax errors is beyond retarded. This may sound stupid, and the more seasoned programmers will mock me for this, but a good IDE is imperative to being productive with code imho.
Auto completion is just a hell lot harder in a dynamic language like Javascript or uscript or whatever. I've still yet to find a really good Javascript editor. 
Last edited by Maph; 02-17-2012 at 01:01 PM..
|
, polycounter,
954 Posts,
Join Date Mar 2011,
Location Nottingham, United Kingdom
|
c# + Visual Studio.
c# may be a little more daunting but the Intelisense more than makes up for it. good autocompletion and typed variables remove a massive number of potential bugs from your code.
|
, veteran polycounter,
2,970 Posts,
Join Date Feb 2010,
Location Ireland
|
Holy crap. What awesome feedback. Thank you all.
|
, null,
18 Posts,
Join Date Feb 2012,
Location USA
|
Is it possible to use UnityScript and C# in same project?
|
, null,
7 Posts,
Join Date Feb 2012,
|
ya you can mix it all up kHellstr
|
, card carrying polycounter,
2,273 Posts,
Join Date Nov 2010,
Location Halifax, NS, Canada
|
I think to be able to access UnityScript classes in c# you need to have them compiled before the c# classes compile. The other way around works fine.
|
, polycounter,
954 Posts,
Join Date Mar 2011,
Location Nottingham, United Kingdom
|
I believe you can only do proper hash tables in C# correct? There is a hacked version you could do in Java as well but not as efficiently. Correct me if I'm wrong.
|
, spline,
134 Posts,
Join Date Sep 2007,
Location Europe
|
this thread makes me want to finally open that C# book i bought ages ago.
|
, dedicated polycounter,
1,331 Posts,
Join Date Aug 2011,
Location Berlin
|
Since the performance is the same regardless of what scripting language you use (This has been officially confirmed AFAIK) I usually just use Unityscript (Javascript) since most Unity examples are in javascript.
|
, spline,
166 Posts,
Join Date Dec 2011,
Location Iceland
|
Quote:
Originally Posted by Denny
I believe you can only do proper hash tables in C# correct? There is a hacked version you could do in Java as well but not as efficiently. Correct me if I'm wrong.
|
Nah, I'm using regular hashtables in Unity using Unityscript.
|
, dedicated polycounter,
1,432 Posts,
Join Date Mar 2007,
Location Leeds (UK)
|
My bad, I must have mixed something up.
|
, spline,
134 Posts,
Join Date Sep 2007,
Location Europe
, null,
12 Posts,
Join Date Mar 2012,
|
It's easier to write slower code with C#. No type checking means that sometimes there might be hard to catch bugs.
Not a big difference, but I like the more clearer code that C# forces you write.
|
, spline,
205 Posts,
Join Date Nov 2009,
Location Finland
|
Just add #pragma strict at the top of your .js scripts to switch off dynamic typing. Voila, easy to debug unityscript.
I'm learning C# coming from an as3 background though, since it seems like a more generally useful language overall. Only so much room in my poor artist brain for computer languages.
|
, dedicated polycounter,
1,874 Posts,
Join Date Oct 2004,
Location Singapore
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Copyright 1998-2012 A. Risch
|