Search Unity

What's the best way to learn C#

Discussion in 'Scripting' started by Bridgeman, Mar 26, 2015.

  1. Bridgeman

    Bridgeman

    Joined:
    Apr 13, 2014
    Posts:
    33
    So I'm familiar with the basics of programming. I know what variables are, if statements, integers and floats and booleans, etc etc etc. I've done some JavaScript programming in Unity in the past, and some C#, but that was years ago so not much of it has stuck.

    I can follow tutorials, but most of the time I'm just typing over the code, not knowing what most of it means. Reading Unity's syntax to me is like reading arabian. Vectors, deltatime, coroutines, and a hundred more things I have no idea how to use.

    And as soon as I try to make something without a tutorial I run into a 100 problems, and when I find the answer there's 10 new problems for it.

    So my question, what's the best way to learn Unity C# in a way that will stick?
     
  2. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    Step 1: Pratice.
    Step 2: Start over.

    Give yourself simple goals, and succeed at one after the other.

    Ideas:
    - Door system to navigate a maze like scene
    - Pickup system that gives points
    - Pickup system that unlocks use of an item (like a gun)
    - Shoot system (uses ammo you can pickup, leave a decal on target spot)

    etc etc...

    Doesn't really matter what you do, in the end only gained skill counts. Don't hesitate to delete your work when you think you can do better, then start over and do better.
     
    Kiwasi and lordofduct like this.
  3. Bridgeman

    Bridgeman

    Joined:
    Apr 13, 2014
    Posts:
    33
    Everyone says that, but I can't practice if I don't know the syntax
     
  4. Fajlworks

    Fajlworks

    Joined:
    Sep 8, 2014
    Posts:
    344
    Generally, syntax is not a problem. If you have an extensive programming knowledge, learning the syntax of C# is merely a matter of weeks. I came from Objective-C background, it took me few days to learn most of the syntax. Coroutines, deltas, events and other tuff took me maybe 2 weeks to fully grasp their concepts and their power.

    If you shipped atleast one product you should do fine. If you're just a hobby programmer what _met44 said, find a project you would like to work on and practice slowly, programming is like piano you could say; you can't really learn how to play songs in few days, it takes months, even years. Good luck!
     
  5. BenZed

    BenZed

    Joined:
    May 29, 2014
    Posts:
    524
    Then learn the syntax.

    Third search result from typing "learn c#" into google:

    http://www.learncs.org/
     
  6. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Ya the syntax is by far the easiest part. It's coding in a way that best utilizes the benefits of the language that is difficult to learn. Pick a simple project and just work on it step by step, one piece at a time. You'll pick up on syntax within hours and you'll have a really good understanding of the core of the language within a week or two, easy. I came from a strictly python background and it was about 2 weeks until I was coding fluently without having to constantly check online for how to create a dictionary or something.
     
  7. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    Learning how to program is usually recommended in the most basic colorless text editor to avoid interferences but since you're probably using MonoDevelop you might as well use an IDE that isn't confusing.

    Go ahead and get Visual Studio Community Edition (free for individuals) and set it as default code editor in unity, so you have the best error feedback & UX available.
     
  8. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,532
    Exactly what went through my head when I read their post.

    OP - there is no true "best" way. Sure, there's bad ways (reading a book on Chinese history underwater is probably a really bad way to learn C#).

    Learn the way you learn most things... that is how YOU learn them. Read tutorials? Practice? Read books? Chat with people who are willing to offer up their skills to you? Practice? Oh... and have you considered practice? Go with whatever route keeps you interested.
     
  9. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
  10. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    You are not talking about syntax. Syntax is about symbols, like .,:{}. Syntax is about making sure you put a void after modifiers but before the method name. Syntax is about matching brackets, line endings, parameters and the like. Syntax is pretty easy, you should be able to pick up the basic rules in a couple of weeks. Syntax is also tied to the C# language. Any C# tutorial will teach you syntax.

    You are asking about the API. The best way to learn the API is to just dive into the Scripting API Reference. I would suggest becoming familiar with Transform, MonoBehaviour and GameObject. These are the three core classes you will use. There is a ton of other stuff, but most of that can wait until you need it. The API is unique to Unity, and you need Unity specific resources to learn it.
     
  11. kdubnz

    kdubnz

    Joined:
    Apr 19, 2014
    Posts:
    177
    jtsmith1287 and Kiwasi like this.