Search Unity

How hard would you say it is to shift from C++ to C#

Discussion in 'Getting Started' started by Deleted User, Aug 14, 2019.

  1. Deleted User

    Deleted User

    Guest

    Hello,

    I'm an Unreal Engine 4 user and throughout this year I've started learning C++ to work with UE, it is fair to say that I'm a begginer when it comes to programming in general, C++ is the first language I have ever started to learn.

    I want to create small scale projects for practice (3D or/and 2D) on my non-gamer laptop (it is a surface pro) so I can't use UE4. I started using Godot but I don't really like it. So I'm now heading towards Unity which, from what I've seen has no real minimum requirement so it should be fine as long as i'm not too crazy.

    But my main question concerns programming, as stated above i'm a begginer in C++ and Unity uses C#, I wanted to know how hard it is to learn C# with basic knowledge of C++ ? I don't want to completely give up my C++ learning for C# and learning two languages might be a bit too much. I'm aware C# and C++ are different languages with different purposes and intentions but I was hoping a lot of notions I've already covered can be easily transfered over C#.
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    C# is simply easier, and I, and many other C++ programmers of yore took about a day to ... switch?
    To be honest I'm shocked you're even asking.
     
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Principles of programming are more less the same across whole spectrum of programming languages.
    Specially with more modern languages.
    If you know how loops, variables, functions work, moving to another language is not that problematic.
    Of course, you will need to learn a bit different syntax, but other than that, C# is much higher level programming language. So technically should be easier.

    However, there is lots of Unity related methods (functions), which simply need to be learned over the time. Just like in any other Game Engine.
     
    Last edited: Aug 14, 2019
    JoeStrout and Deleted User like this.
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah but engine API is not language so it should be trivial mostly. Like in UE4 it's possible to inherit from an actor (called monobehaviour in Unity land) which will provide easy coupling with the engine.

    I was going to write a conversion guide but that fell though so I'm not sure what's up in Unity land regarding a guide for it but feel free to ask any questions or orient via the learn section.
     
    Antypodish likes this.
  5. Deleted User

    Deleted User

    Guest

    Ahah I guess this is fear of the unknown! That's reassuring thanks.


    Thanks, Indeed these Unity specific methods are not part of C#, this will probably be wrapped up when learning how to use the engine itself
     
    JanetRGilbert likes this.
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    C# is more or less C++ and Java had a baby together. You'll notice a lot of C++ syntax is either taken directly, or with just slight modification.

    Really the biggest difference between the two isn't the syntax itself, but how you generally end up writing programs. Often in C++ you end up with a lot of manual memory management and use of pointers. C# though typically doesn't use pointers, and uses a garbage collector to free memory no longer used.
     
    JeffDUnity3D likes this.