Search Unity

Best Unity / C# scripting courses

Discussion in 'Scripting' started by yusefkerr, Aug 26, 2019.

  1. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    179
    Hello, I've been using unity for around 7 years, mostly creating 3D art for other people and occasionally fudging my way through simple scripting tasks in c#, with heavy copying and pasting from online examples. I've created several playable experiences and generally managed make things work adequately for my needs at the time.

    I'm a bit frustrated though, as I still feel like I don't fully understand what's going on half the time, and I wanted to concentrate on developing my c# skills over the next few months to try and become a bit more solid as a scripter/programmer.

    Are there any really comprehensive Unity/c# courses that people would recommend? Something that perhaps starts at a low intermediate level but covers a lot of ground?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    I'm not sure what formal classes there are today, but there's plenty of random stuff on the web. You can learn a lot by doing a lot of different tutorials, but tutorials can be really hit or miss.

    The main hurdle you want to get over is identifying what you are learning, so that when you are learning it, you can put it into the correct slot in your brain.

    Broadly you will learn these two main things, so it's helpful to think of these steps as you are learning:

    1. how to solve a problem to make something happen (describing the problem, identifying the parts, reasoning about it, defining steps, what objects to make, what routines to make)

    2. how to write a C# program to actually do those steps (syntax, formatting, etc.).

    Most of the online help is going to come in part 2 above, but there are some courses to address part 1. Mostly with part 1 it will be self-developed as you gain familiarity with different game problems.

    Part 2 also can be broken down into specific steps, just talking about the context of C# programming in Unity:

    2a. learning specific C# syntax (if, for, else, while, class, struct, arrays, etc.)

    2b. learning the C# API (all the "bigger picture" stuff that C# can do for you, like Lists, Dictionaries, etc.)

    2c. learning the Unity3D API (how to talk to Unity, how Unity will talk to you, and what specifically you can do)

    So keep the above in mind as you tackle tutorials... I would recommend watching game developers on Twitch until you find one that explains their thinking as they work, and also trying some Youtube tutorials.
     
  3. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    Hi, since there was a very similar thread recently, i'll just leave that here:
    https://forum.unity.com/threads/how-hard-is-c-to-learn.733286/#post-4892345

    You will find some good advice for tutorials and books, as well as general advice on what there is to lern and so on.
    The thread is mainly focussed on C#, so as Kurt said you need to take a closer look at the Unity/C# integration afterwards. Generally understanding the programming language should be your first priority tho.
     
    Kurt-Dekker likes this.
  4. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    179
    Thanks, I feel like Kurt-Dekker's "2b - Bigger Picture Stuff" is an area that I recognise I'm missing. Can you explain what you mean by the "Unity/C# integration"?
     
  5. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    I'm not a native english speaker, so i may have chosen a wrong word there, but i believe integration still fits.
    Anyways, what i meant with that was mainly these two topics:
    • Understand the Unity API. Know what it offers, so you know what tools you have to work with.
    • Understand the Unity workflow. How to do you connect / use multiple scripts? (GameObjects, Components, ..)
    This all comes down to how knowing your tools helps you approaching a problem in an appropriate way. Know which (self-made) components you need in Unity, know how to get each component to work.
    I believe you are familiar with the Unity workflow, so this is mainly about knowing as much about what the API has to offer as possible. I dont think it's humanly possible to know everything the API has to offer, but at least the basics plus areas of gamedevelopment that interrest you should be possible. This includes the absolute basics like Vectors, Transforms, GameObjects, the Component System (how to get what you want inside of a script) and so on. And then some more specific areas that depend on what you are mainly going to do. 2D vs 3D? Do you need physics? Do you intend on making character controls? Design your own follow camera? And so on. Each of these topics (and many more) have their own parts in the Unity API, so whenever you intend to work on any new topic, it is a good idea to see what the API offers you (and probably looking up some examples, but not to copy/paste them, but to try and understand what does what and how you can get it to do what you want).

    In 2a & 2b Kurt basically talks about the same thing, but focussing on C# (his 2c would be about what i just wrote). This as well goes in the direction of: know your tools so you can determine the best way of approaching a problem. Similar of how there are things in the Unity API that save you a lot of time (for example using Vectors and their provided functions instead of implementing your own solution), C# basically also has an "API" of state-of-the-art solutions to problems you often encounter. Examples (focussing on Kurts' 2b):
    • Normal arrays have a static size. You define it at creation and then work with it. However, you often want an "array" that can dynamically resize if you add too many elements. So in C# (and most other languages for that matter) there exists an object called "Lists" that wraps the standard array and adds functionality to automatically resize it if needed.
    • When you have a long list of items, but you need to find a specific one, then you generally have to iterate over all (1.000.000 for example) elements to find the one you need. This takes time. A Dictionary (mostly called HashMap anywhere else) in C# allows you to map keys to values. So you can, for example, look up the birthday of a person (value) by looking up their name (key) in the dictionary. This has two advantages: first of all the lookup process takes O(1), meaning constant, time no matter how many elements there are in your dictionary (this statement is simplified but often true). Secondly, it allows you to look up elements based on any input-type, like in the example a string name (where as arrays / lists work over indices of type int only). Both of which can be highly useful in certain situations.
    There are more than these two, but Lists and HashMaps are already two of the more useful things you will encounter. Then we have Queues, Sets, other Collection types, Trees, ... and so on.

    In the thread i linked you i explained how i would go about learning C# from scratch. You should directly see that post when clicking on the link. There i go over the (imho) most important, basic concepts you need to learn to be able to work with C#. I'd highly recomment following my post, looking at everything you dont know (and exercising those parts you do know) until you feel confident on everything i wrote about.
    Afterwards you can google around a bit to look into HashMaps and other useful tools that may help you later down the road.

    As for the order in which you should learn these things, i'd highly recommend:
    Basic C# (Covered in my post) --> Other tools C# has to offer --> Object oriented programming -->
    Unity API --> Combining all previous knowledge to get stuff done in your own scripts --> Linking multiple scripts / components to get the desired behavior

    Keep in mind that certain steps (C# tools, Unity API or OO programming) are not really possible / intended for you to master when they come up in this list, as they are huge topics on their own. Rather take a closer look at them in that order and learn the basics / most important concepts (for your goals). Afterall, after you are confident in your knowledge enough to start working, you will improve all by yourself, simply by learning new things here and there.

    If you got any more questions, feel free to ask.
     
    Last edited: Aug 27, 2019