hello.
I recently chose to start learning C#, after i chose not to learn java.
What is a good C# beginners learning resource that goes well with unity?
-t
hello.
I recently chose to start learning C#, after i chose not to learn java.
What is a good C# beginners learning resource that goes well with unity?
-t
You might try the Microsoft Visual Studio Express editions. They are free and are good IDE’s.
Do this first:
http://www.softsteel.co.uk/tutorials/csharp/cIndex.html
This might be useful:
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=16
After that, I’d just play around doing simple stuff with Unity and move through it like that. Make sure to learn OOP (object-oriented-programming) concepts at some point, and you should be good.
There are some gotchas with Unity ↔ C# that can be hard to figure out at first, but ask here and ye shall get an answer.
For example, in the JS samples for GetComponent you will see it is used like this in JS:
var myRB = gameObject.GetComponent("Rigidbody");
In C#, you have to use the typeof function to specify a type like this:
Rigidbody myRB = gameObject.GetComponent(typeof(Rigidbody)) as Rigidbody;
It can look wierd at first, but once you get it you are fine.
HTH,
-Jeremy
I keep a copy of C# In A Nutshell handy. Good concise language reference, and the rest of it is a description of the .Net library classes, many of which are usable in Unity (via Mono.) There is a HUGE amount of functionality there.
I’ve found Jesse Liberty’s “Programming C#” useful, initially as a tutorial and later as a reference. However, like all O’Reilly’s “Programming XXX” books, it assumes you are coming to C# from some other language(s).
O’Reilly have actually got quite a few C# books now:-
http://www.oreilly.com/pub/topic/csharp
Some C# books place heavy emphasis on web programming, though, and this doesn’t really have much to do with Unity. You might want to avoid these in favour of books that just cover the core language and libraries.
thanks
(I don’t know how to program at all since im entirely beginner, but i’ll give em a try )
(worded my above post wrong, i do not know java, and i decided not to learn it)
http://msdn2.microsoft.com/en-us/library/67ef8sbd(VS.80).aspx
Eew… Microsoft website.
This is where I look up C# stuff.
Maybe i should reword:
I know nothing of how to program and i want to start using C# and unity. Where should i begin?
Hi.
Is there a particular reason for choosing C# ? I would argue that it would be easier to get started using Javascript. Almost all examples in the documentation are Javascript + the tutorials, so I think it’s a lot easier to get started if you choose Javascript. Once you’re into the whole Unity+scripting world it’s not so hard to switch to C# if you still want to do that at some point. Anyway, just a suggestion.
/Patrik
hmmm. I chose C# because, well, i’d guess its like C++ (no, i do not know c++) and because i guess it seems a bit more game dev oriented, and is what unity supports best.
I’m not sure that’s the case…the docs use Javascript for all the examples. There are a few things you can’t do (or do easily) in Javascript that you can in C#, but the opposite is also true. C# isn’t any more or less game dev oriented than Javascript as far as I can see.
–Eric
NO LANGUAGE IS GAME-ORIENTED.
Libraries can be game oriented.
Languages are languages, they allow you to talk to the computer, and that’s it.
Unity’s library is game-oriented. You can use it with C#, JS, and Boo.
MS ASP.NET libraries are web-oriented. MS XNA’s library is game-oriented. You can access these with any CLR language: C#, VB, JS.NET, hell Boo and Ruby.NET too if you’re into that, and I probably forget a few!
The gaming industry favored C++ for years but a) I think it’s coming to an end because C++ is aging fast, and b) it’s more important if you want to write an engine; scripting is usually done with a very wide variety of languages. You don’t need C++ as badly as before to get a job.
That aside, Javascript is probably a bit easier to learn, but what I think is tricky is that a huge amount of the resources you’ll find on the net are browser-JS, so web-oriented, and quite often very poorly written and bad practice (although with web 2.0 the standards are getting way higher).
But, the resources you’ll find on that forum are very often in JS, so again, easier to learn.
Although you’ll notice that every time someone shares higher-level resources, they’re usually in C#, because it allows a few more complex operations than JS.
If I didn’t bore you already you can read more of my ramblings here.
The only limitation I ever encountered with JS is the fact that there’s no way to create multidimensional builtin arrays. That said, anything done in a multidemensional array can also be done in a single dimensional one, it might just be a little bit more inconvenient.
The biggest problem with choosing C# in my opinion is that you often have to ask here in the forums if you need help, whereas with JS help is readily available in the docs tutorials.
/Patrik
Actually, I disagree. You can pick up almost any C# tutorial on the web or the local book store and apply it right away. Not so with JS like benblo said.
Unity’s JS implimentation was written by Otee, so you rely on them for the docs for the specifics, while C# is just a standard language with a standard interface to the Unity APIs.
Either way, they are both “easy” enough to find information on if you know where to look/ask.
-Jeremy
Someone suggested that Unity’s Javascript should be called UnityScript… the more I use it, the more I think it’s a very good idea.
Maybe for marketing purposes they could subtitle it “based upon Javascript”, or maybe not even, because when you say “Javascript” people think “browser”, and the fact that multiple implementations coexist in the web sphere makes it hell.
Actually Mozilla’s implementation is really good and pro, even has some stuff Unity’s hasn’t (getter/setter), but lots of the others suck big time (hello IE).
So maybe Unity should detach itself from this mess, plus UnityScript sounds pro, like UnrealScript or such 8) .
Good idea!
I agree. They could make up some quick docs on it, and call it a day. Good idea.
-Jeremy
C# is nothing like C++, at least no more so than Javascript or even Java. Microsoft, in my opinion, chose the name to confusion people into thinking it was somehow related and/or as powerful as C++. Basically it is just marketing scheme to make project managment feel good about the language. They could have just as easily called is MicroScript or maybe MS#, dont let the “C” fool you. With that said, C# is a great language and it isn’t a bad idea to learn it. But as far as using it for Unity… well thats simply a matter of personal choice, I don’t see that it makes any difference. Use C# if you already know it (or want to learn it), otherwise use javascript and be done with it.
I was under the impression that C# was sort of a Java competitor/clone, but not having used either much, I could be quite wrong about that… (Definitely not like C++, for sure.)
–Eric
C# is supposedly the fusion of C++ and Java.
Java is based on C/C++ anyway… actually, a lot of modern languages derive from the C syntax (PHP for example).
C# is just more modern, high-level, taking into account the new hardware and getting rid of a lot of compiler baby-sitting (C++ pointers just belong to an age when everything was more difficult and low-level, and we had to whisper in the ear of the machine).
Plus integrating the whole namespace notion from Java: also a treat for architecture, clearly more abstract and high-level. It’s also virtualized like Java (CLR = 100% managed).
So yeah, I think it’s ok to think of C# as an evolution of C++, just as C++ was an evolution of C --those two also are very different, yet nobody questions the name. When was the last time you tried to use C, and cried your eyes out?
Just as it would be ok to call Unity’s implementation Javascript, or JavaUnity or something… if Javascript didn’t have this ugly web ring to it.