Search Unity

Question How to learn c# for unity?

Discussion in 'Scripting' started by dhruvchoksi099, Dec 27, 2023.

  1. dhruvchoksi099

    dhruvchoksi099

    Joined:
    Dec 14, 2023
    Posts:
    1
    I want to learn c# programming so that i can make a game of the type i want write scripts according to it and all but i dont know where to exactly find the exact thing to learn from where it teaches from scratch to the end about c# and also i have very little programming knowledge with just basics of c++ and python. What to do can u recommend some of the good ways and place to learn c# from? Also i am familiar with unity as i have made one prototype and a game on unity from the courses i took from unity and Coursera (c# scripts were provided in it before hand)
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,890
    https://learn.unity.com/pathway/junior-programmer

    At the beginning you just want to get comfortable with C# in general. It can also be worthwhile learning C# on it's own then picking up Unity.

    Wanting to find tutorials to make the specific game you want to usually doesn't work. Game dev is constant problem solving, so you need to build up that first and foremost.

    And the best way to do that is to just code a bunch and learn as much as you can.
     
    Nad_B and Bunny83 like this.
  3. Nad_B

    Nad_B

    Joined:
    Aug 1, 2021
    Posts:
    731
  4. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    I personally like to recommend the tutorial series by Sebastian Lague:


    He explains the core concepts of coding really well and gives you small Unity related tasks and games to work on. No matter where you start tho, no tutorial will teach you everything you need. Programming is always about learning new things. When you do something new, you will always look up how others did it, or what the documentation has to say about certain functions. That is programming. After you have the basics down, just start working on small projects to build experience and confidence.

    Programming is absolutely learning by doing, so even while you watch or read your first ressources on the topics, dont just let it sink it, do something with it!
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,708
    You won't learn much by pure reading.

    You may learn by reading and then doing.

    The doing is where you're actually learning.

    Your learning will be (largely) broken into broad areas of knowledge.

    You may find these main buckets helpful to organize your learning:

    - C# language syntax (organization, structure, grammar, punctuation)
    - the .NET API (all the tools that come with C#: lists, dictionaries, file IO, etc)
    - the Unity API (everything in the
    using UnityEngine;
    namespace)

    Beyond that mechanical stuff comes the interesting stuff: how to actually solve real world problems.

    I like this iterative small-bites approach:

    Imphenzia: How Did I Learn To Make Games:

     
    Sluggy and spiney199 like this.
  6. Owen-Reynolds

    Owen-Reynolds

    Joined:
    Feb 15, 2012
    Posts:
    1,998
    My programming "book" is at taxesforcatses.com/TOC.shtml. I taught intro college programming (in C++), but it's all the same. It's focused on general programming, but uses C# in Unity with game-like stuff for most examples.

    The problem with the microsoft site is it's a manual. It gladly explains obscure obsolete stuff (without telling you that) since you may see it in old code. And it doesn't do that great -- the examples tend to be too long and only show the simplest version. Since it's a manual, it won't tell you that if's, loops, functions and Lists are the main things you want, or give examples of how to solve problems with them.

    The Unity learn site is just barely a start, with just 1 example of things. It was also continued by microsoft people (I think I read that) who didn't make the new stuff consistent with the old (video is tough to change). It's also in a weird place between learning to program and seeing Unity examples.
     
    Nad_B likes this.
  7. Nad_B

    Nad_B

    Joined:
    Aug 1, 2021
    Posts:
    731
    Yes C#/.NET official documentation is a little bit overwhelming and often not organized in a manner that helps new programmers (the exception being ASP.NET documentation which is excellent). But the learning videos by Scott Hansleman are excellent (he is an excellent tutor, and overall a good, down to earth guy you can easily reach on Twitter).
     
  8. Owen-Reynolds

    Owen-Reynolds

    Joined:
    Feb 15, 2012
    Posts:
    1,998
    They seem nice, but suffer from some common problems (which have nothing to do with Scott or Kendra). One, they're more like language surveys -- a fun look to motivate you read the real explanation with all of the missing details. Like, the first (coding) one shows the printing style with something like "my name is {} I like to eat {}" , using actual string variables like: string food = "pizza";. Fun. Then the next jumps way, way ahead into: w.contains("cows"). Also fun, but covering member functions in the first 1/2-hour of Intro To coding is a bold move.

    Another, related, is that the site those videos use lacks focus. The first written part starts out explaining what types are, but quickly goes into enums and classes, and mentions they all inherit from object. It's like someone started writing it for beginners, then the next person continued it but for experienced programmers (and see below).

    And then, no examples of techniques. The written IF section has if(a+b<10) and if(a+b+c<10), an "else", then jumps right into while loops. Where's "n between 1 and 10" or "n is either 2, 8 or 15", or nested ifs, and so on?

    So yes, the videos are nice (despite my feeling that Kendra doesn't much care for Scott) but like, that math one uses a=5, b=2, c=4 and prints stuff like a+b*c to show precedence. It's better to use simply: print( 5+2*4 ). But S&K didn't write the lesson -- that was 5 other people (check "Contributors"), which kind of shows: it mentions integer division before we're seen floats or understand that "int" means no decimals. Someone with teaching experience needs to own the site, cut a bunch of stuff, redo it with a focus on new coders (and who's going to tell S&K they need to do new videos?) and own it for long enough to prevent it growing back into a confusing grab-bag.
     
    Nad_B likes this.