Moving to C# - Is Knowledge of C, C++ Necessary to begin?

Till now, I only and only used Unityscript for my games, when I started game development I was beginner to programming, and hence chose Unityscript(as it is dynamically written and kinda easy to grasp). Now, after reading lots of opinions I want to give C# a try.

One thing I am worried about is, I have no experience with C, C++. I have heard that C# is on their stream, so I was worried if Moving to C# without having knowledge of C or C++ right or not? I am familiar with Java but I am only a beginner at Java currently.

So what’s your opinion, should I move with C# anyways?

Check out my signature to learn how to code interactively with C#. Also check out Codey’s Lab on the asset store, an interactive coding tool that teaches you to make games in a simulated unity environment that runs directly in the unity editor.

As to answer your question, knowing c++ can’t hurt, but it’s not necessary. C# is most definitely the way to go over any other language offered by Unity.

1 Like

I don’t know what you could possibly mean by “dynamically written” but C# is easy to grasp if you already know OOP.

If you have a passing familiarity with actual Java, it should be even easier to get into C#.
My recommendation is to Google “differences between java and c#” and you’ll find some key points to note (base instead of super, : instead of “extends”, interfaces, structs, enums), but you’ll also find that they’re not too far apart.
MSDN C#/.NET references will also be your friend. Just keep googling things you don’t quite get and you’ll figure out the differences in no time. You’ll also have a wealth of non-Unity C# code examples elsewhere on the internet.

Should you switch to C#? Yes.
In the bigger picture, C# is the more recognized and supported language, not just in Unity. C# is more explicit, and allows you to more completely make use of Mono’s features, but it’s also cleaner and potentially less typing compared to UnityScript (even more so when Unity gains compatibility with the new compiler).

In terms of syntax, Java is really its closest relative.
C and C++ are pretty far from C#. Coming from them would have actually been a bit more confusing. Only a bit.

What C and C++ do give you is an appreciation for what managed runtimes like Java and .NET/Mono do for you. But that’s nothing you can’t read about in less than an hour. Knowing some parts C/C++ would amount to lots of trivia about memory management and optimization in general, which can help, but if it does, it helps with general programming, not with C# specifically.

1 Like

Not necessary at all.

Actually having experience with Java will be more helpful when moving to C# than C/C++ would. C# was developed by the same guy at Microsoft who worked on Visual J++ which was a Microsoft Java implementation, and C# carries a lot of Java like design with it. So much so that James Gosling even referred to C# as being an imitation of Java that was less reliable.

The language carries the C name only in that it’s c-like. Java is also c-like too. But so much is different from C/C++ and C#… sooooooooo much. There’s no explicit pointers, there’s no need for header files, memory management is dealt with for you, the list of differences is long.

So yeah, don’t worry about not having C/C++ experience in writing C#.

Oh, and unityscript is not a dynamic language. Unityscript compiles into the CIL (common intermediate language) used in .Net/Mono that C# does. Some could argue that reflection can give some dynamic capabilities… but that comes out of the framework, and not the language.

Unityscript LOOKING like javascript (which is dynamic) doesn’t necessarily mean it carries the dynamic properties of javascript.

1 Like

The short version is no, you don’t. UnityScript is C# with a pretty dress, some makeup, and a lot of dumb. It’s the same language, but with somewhat different syntax.

c it’s big brother c++ is a lot further away from C# than UnityScript is, so you actually have a better basis for understanding C# than if you knew some C.

Longer version:
The syntax of C# is very heavily inspired by Java, which in turn is based on the syntax of c++, which is c pluss a bunch of stuff.

Unity’s UnityScript (aka “JavaScript”) has a syntax that’s kinda similar to real JavaScript, which in turn is named JavaScript because it’s a Scripting language that’s made to have syntax that looks like Java. A bit. If you look at it from an angle.

Both UnityScript and C# are ways to write code for the Mono runtime, which is an open source implementation of Microsoft’s .Net framework. What this means for you is that both languages does exactly the same things after they’ve been compiled.

C and C++, on the other hand, belongs to a different language family entirely. The main practical difference between them and C#/UnityScript is that in C/C++, you have to manage memory directly, rather than having the Mono runtime do it for you.

1 Like

really helpful opinions there… thank you everyone for giving valuable opinions, definitely I would look into C#(Both in Unity and Globally).

oh, Thanks for pointing that out. I was a little confused about unityscript and Java script.