Quick question regarding c# and c++.
I'm looking into online courses to learn unity a bit better. Ultimately, I'm trying to learn c++, but every course I can find only uses c#. If I take a course using c#, is that gonna cause me confusion while I continue to learn c++?
About this post
- Posted
- Archived
- Score
- 1 · 100% up
- Kind
- Text
- ID
- pbduei
6 comments
I think you can use C++ in Unity but, from my limited understanding, it’s a bit inconvenient and you’d have implement some workarounds or write your code slightly differently. Good question though…
But why wouldn’t you just use C# if it will achieve what you need the game engine to do? Why do you specifically need C++ to make a game in Unity?
Oh I don't need c++ for game design. I just wasn't sure if learning c# in unity would conflict with my learning c++ outside of unity, or if they would be similar enough that it wouldn't make much difference. I still want to learn c++ for outside of game development.
Hi. I'm not a game developer (just a software engineer), but I will try to give some info.
C++ and C# are very different (except for basic syntax which they both inherited from C language). There are some advantages and disadvantages in learning both languages at the same time.
Advantages
All programming languages share the same concepts (stack, heap, functions, classes, structures, variables, loops, methods, collections, threads and so on). And every language uses quite different approach to that. So if you will learn those to languages at the same time you will better understand them both. In particular memory management is very different. In C# you have references, in C++ you have pointers. In C# you don't need to think about deleting objects, in C++ you do. C++ doesn't have garbage collector, C# (if I'm not mistaken) does. So just comparing how those two languages approach the same concepts (in this case memory management), you will have much much better understanding of them.
Disadvantages
The main issue with C++ that this language is quite complicated. It can overwhelm you. Pointers, smart pointers, references (completely different thing from references in C#), RAII, move semantics and this is just a beginning of all things that you can use in terms of objects, variables and function arguments. So, it can confuse you and slow down a lot. If you're completely new to programming languages you will have very hard time following all those things from different languages (which might have the same names but work in completely different ways) at the same time.
Or you can always learn C# and after you will feel comfortable, just move to C++ and re-learn the same concepts in different form (it's quite fun and interesting!). So I will recommend just to focus on one language (it will be much faster) and then move to another. But if you have a lot of time (infinite time ;D) and patience, you can try both.
I hope this info helped you.
And from motivation point of view: just learning one language without any basis might be quite frustrating sometimes (even if this language is quite easy to learn). Because there are lot of cases when you just don't understand why thing that you wrote just doesn't work the way it suppose to. And when you had quite hard time in one language (just a bad day), switching to another language which uses the same terms but might work in different way, might confuse you and create even more frustration. And again you might feel overwhelmed by everything.
But if you will just learn one language and have very good understanding of it, learning new languages after that will be much simpler and more rewarding.