Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Anyway to break down C# to make it more manageable to learn?

Discussion in 'Scripting' started by sarmander, Apr 26, 2014.

  1. sarmander

    sarmander

    Joined:
    Apr 26, 2014
    Posts:
    2
    I know there has already been a ton of topics on learning C# but whenever I try to start learning I just become demotivated and stop because of how much there is to learn and how challenging it can get. I used the tutorial on Brackeys (I think it was) and it wasn't bad. So my questions are, can you learn C# is smaller bursts, because whenever I want to learn I always try to have 1-2 hours free and uninterrupted, it just seem like I can't do it 30-40 minute sessions, and you know how they say break big tasks down into smaller ones, well learning C# is a really big task so can anyone help break it down into smaller tasks?
     
  2. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    In the past when I have helped people to learn to get started with programming I have found it beneficial to start with some unexplained givens. I.e. starting templates which are not explained until later, but provide a simple framework to get started.

    In Unity this would be the following skeleton MonoBehaviour:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class YourBehaviourName : MonoBehaviour {
    5.  
    6.     private void Start() {
    7.         // Initialize your behaviour instance...
    8.         Debug.Log("Just starting up...");
    9.     }
    10.  
    11.     private void Update() {
    12.         // Perform per-frame updates...
    13.     }
    14.  
    15. }
    16.  
    In the above you do not need to fully understand what a class is, or what a public/private function is at this stage. You can instead focus upon learning statements and placing those inside Start/Update.

    Outside of Unity-land this skeleton might be a simple "Main" function which spews out the message "Hello World!".

    If you are teaching yourself then I would definitely recommend that you buy a good C# book and that you spend some time learning the language. A good resource for C#-specific questions (i.e. questions which do not relate to Unity) is http://stackoverflow.com/

    I don't know if this will help, but I hope it does! :D
     
  3. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Code Academy is a fantastic place to learn how to code. They don't cover C# explicitly, but anything you learn about basic Python or Javascript programming will be relevant.

    For learning programming in general, start with basic syntax (brackets and parans and operators), functions, variables, if statements, and for loops. Once you know how to use those things, learn about classes (including member functions, member variables, and inheritance). Once you understand these basic building blocks, you have pretty much everything you need to start writing C# or Javascript code in Unity. There's tons more to learn, of course, but that will give you a solid foundation.
     
  4. sarmander

    sarmander

    Joined:
    Apr 26, 2014
    Posts:
    2
  5. Moosetaco

    Moosetaco

    Joined:
    Jan 27, 2013
    Posts:
    77
    Not that I'm considering myself a programmer right now but that's what I would recommend. I did both the Python and Javascript modules, did the Unity tutorials from the WalkerBoys Studio site (which also provide some decent tutorials on Javascript). After that I watched some videos to learn the C# syntax then rewrote the Walkerboys tutorials in C#.

    From there I've learned a great deal more just by playing around in Unity. While at work I'll comb through these forums and the Answers section for code to read through and try to understand - Additional benefit to that is that when I run into a wall/get confused/have a question, more often than not, I will have already seen or read a solution and can quickly find it again.
    However, I should probably just crack open my safari account and read a C# book =/