Author : ysalex


Reply
Reply
 
Thread Tools Display Modes
LW3's Avatar
Old (#1)
I was curious who uses what for scripting: Javascript (or UnityScript since it's not exactly JS), C#, or Boo. - LW3
Offline , null, 18 Posts, Join Date Feb 2012, Location USA  
   Reply With Quote

equil's Avatar
Old (#2)
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.
Offline , triangle, 296 Posts, Join Date Oct 2008, Location gbg sweden  
   Reply With Quote

Stradigos's Avatar
Old (#3)
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
Offline , polygon, 660 Posts, Join Date Feb 2009, Location Michigan Send a message via Skype™ to Stradigos  
   Reply With Quote

commander_keen's Avatar
Old (#4)
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..
Offline , polygon, 618 Posts, Join Date Jan 2005, Location Los Gatos, CA  
   Reply With Quote

kio's Avatar
Old (#5)
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.
Offline , triangle, 324 Posts, Join Date May 2008, Location berlin  
   Reply With Quote

Elyaradine's Avatar
Old (#6)
C#!
Generalist and TA at Luma Arcade
Houdini/Mixamo entry
Offline , triangle, 287 Posts, Join Date Apr 2009, Location South Africa  
   Reply With Quote

Maph's Avatar
Old (#7)
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...
Offline , polycounter, 954 Posts, Join Date Mar 2011, Location Nottingham, United Kingdom  
   Reply With Quote

Farfarer's Avatar
Old (#8)
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.
Offline , dedicated polycounter, 1,432 Posts, Join Date Mar 2007, Location Leeds (UK) Send a message via MSN to Farfarer Send a message via Skype™ to Farfarer  
   Reply With Quote

Peris's Avatar
Old (#9)
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.
Offline , polycounter, 963 Posts, Join Date May 2006, Location Stockholm  
   Reply With Quote

Maph's Avatar
Old (#10)
@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..
Offline , polycounter, 954 Posts, Join Date Mar 2011, Location Nottingham, United Kingdom  
   Reply With Quote

r_fletch_r's Avatar
Old (#11)
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.
Offline , veteran polycounter, 2,970 Posts, Join Date Feb 2010, Location Ireland  
   Reply With Quote

LW3's Avatar
Old (#12)
Holy crap. What awesome feedback. Thank you all.
Offline , null, 18 Posts, Join Date Feb 2012, Location USA  
   Reply With Quote

kHellstr's Avatar
Old (#13)
Is it possible to use UnityScript and C# in same project?
Offline , null, 7 Posts, Join Date Feb 2012,  
   Reply With Quote

passerby's Avatar
Old (#14)
ya you can mix it all up kHellstr
Offline , card carrying polycounter, 2,273 Posts, Join Date Nov 2010, Location Halifax, NS, Canada  
   Reply With Quote

Maph's Avatar
Old (#15)
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.
Offline , polycounter, 954 Posts, Join Date Mar 2011, Location Nottingham, United Kingdom  
   Reply With Quote

Denny's Avatar
Old (#16)
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.
Offline , spline, 134 Posts, Join Date Sep 2007, Location Europe  
   Reply With Quote

cptSwing's Avatar
Old (#17)
this thread makes me want to finally open that C# book i bought ages ago.
Offline , dedicated polycounter, 1,331 Posts, Join Date Aug 2011, Location Berlin  
   Reply With Quote

r3spawn's Avatar
Old (#18)
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.
Offline , spline, 166 Posts, Join Date Dec 2011, Location Iceland  
   Reply With Quote

Farfarer's Avatar
Old (#19)
Quote:
Originally Posted by Denny View Post
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.
Offline , dedicated polycounter, 1,432 Posts, Join Date Mar 2007, Location Leeds (UK) Send a message via MSN to Farfarer Send a message via Skype™ to Farfarer  
   Reply With Quote

Denny's Avatar
Old (#20)
My bad, I must have mixed something up.
Offline , spline, 134 Posts, Join Date Sep 2007, Location Europe  
   Reply With Quote

Luxxa's Avatar
Old (#21)
Some good tutorial to learn c# in unity:
http://robotduck.wordpress.com/2009/11/04/88/
http://www.youtube.com/user/BurgZerg...C2870574BF4B06
http://www.walkerboystudio.com/html/...ml#unity3game2
http://www.youtube.com/user/Luciotsa...4177C28BC55C2A
Offline , null, 12 Posts, Join Date Mar 2012,  
   Reply With Quote

piippo's Avatar
Old (#22)
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.
Offline , spline, 205 Posts, Join Date Nov 2009, Location Finland  
   Reply With Quote

Snowfly's Avatar
Old (#23)
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.
Offline , dedicated polycounter, 1,874 Posts, Join Date Oct 2004, Location Singapore Send a message via MSN to Snowfly Send a message via Skype™ to Snowfly  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch