Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Best way to learn how to script C#?

Discussion in 'Getting Started' started by old_school77, May 25, 2024.

  1. old_school77

    old_school77

    Joined:
    Apr 29, 2024
    Posts:
    5
    Hi everyone,

    I've been trying out Unity doing a 2d platformer project for a few weeks to see if its something i want to mess with. I'm at the very early stages doing the player movement script doing movement and jumping. I want to learn more about being able to script without having to copy and paste or ask questions on the internet. Should i look for books on Amazon? YT tutorial vids? lessons like how Unity has here?

    I've already started looking at YT tutorial videos. Copying their scripts and making it work is easy obviously. I've also been able to make some of my own scripts based on what i learned. I've been able to combine some scripts but having a hard time getting them to work 100% how i want it. I've also bought two Unity C# books on Kindle, not sure if they are any good or not.

    So thoughts? best place for someone to start that has zero experience with scripting? last time i did anything remotely similar was making a program in C64 and computer science in high school making a game with a banana throwing gorilla in Basic.
     
    MadeFromPolygons likes this.
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,556
    If you want to learn how to roller skate, take a tennis ball with you to an open area, toss it somewhere, and go fetch the ball. Repeatedly. Have some arbitrary higher-level goal other than the fundamental learning exercise, so that your subconscious can get busy learning while you're doing something else consciously.

    You're going to struggle to let the lessons hit home, if all you're doing is following the lesson. Make a game. The game can be just as simple as "move a box around on the screen so it is hard to click." Or make Flappy Bird into Flappy Weasel. Or take the Unity Learn lesson Roll-a-Ball tutorial, and turn it into a Gordon Ramsay cooking challenge. Make it yours, and your conscious brain will be so distracted by all the funny little changes you make that you won't notice the experience you're gaining and the familiarity with the subject matter.
     
  3. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    4,002
    Because you colored your links the way you did, I accidentally reported you as "really smart spam bot" :)

    I can see that they are not links but just colored text - my apologies! :oops:

    Regarding where to learn, so while I put some links below - the best way to learn is to pick a very small (like tiny tiny) scope first project and start working on that, and everytime you hit something you cant do or dont know how to do search for a tutorial or article on how to achieve that thing. This will be needed for literally everything for a while during beginner stages so dont worry about that - the key thing is getting into the mindset of "problem solving" early on, as thats all development really is.

    Learning what you need to do, rather than the exact syntax required to achieve it (meaning exact 1:1 code needed) is far more useful, because as long as you know what you need to do you can search the internet for the specifics. Theres this inposter syndrom you get early on into your career where you think that everyone else knows everything by heart - the reality is even the most skilled and experienced programmer googles things all the time. But they know what they need to do and therefore what they need to google.

    Take for example making an inventory system. You could try and memorize the exact code needed to do this but its pointless as there are multiple approaches. But instead if you know:

    1. okay I need some way to display items and their information on a UI as well as organize them
    2. therefore I need to find a way to define and store the data for an item first for any of the rest to make sense
    3. therefore I need to know how to take a saved item data and store data on how many my character holds of each type
    4. therefore I need to take the stored item data and display it on the UI somehow
    5. therefore I need to be able to change the amount I have stored
    6. and finally therefore I need to know how to take what I have learnt solving 1-5 and make a screen that shows multiple of them and move where I show what is stored (think inventory slots in a typical RPG inventory)

    Each of those steps are "sensible scope" problems that can be googled and learned pretty easily even if base knowledge of what to do is at 0 at time of trying. And if they end up being too big once attempted, again the same mindset can be applied to scope them each down into 2-4 sub-steps to make them even more manageable. Rinse and repeat until the scope is achieveable and then get cracking.

    Start with something like pong or some 70/80s classic type game as a first project, its a great way to learn the fundamentals without over-reaching.

    So going in with that mindset and setting yourself a project - here are the best materials:

    Unity Learn with Code - Anyone thats knows me on this forum knows I love pushing this course - its by far the best starting point for anyone learning code with unity and I will challenge everyone that says otherwise to a fistfight :p but in all seriousness - this is an in depth tutorial that will net you multiple mini projects by the end of it that you can tweak and build on, as well as teaching everything you need to start making your own experiences and "thinking like a coder". I wish this existed when I was learning! If you do this course first you dont need to set yourself a project as its broken down into a few "starter" projects.
    Link:
    https://learn.unity.com/course/create-with-code-live-spring-2021

    Unitys "Learn how to code in c# for beginners" - An extremely basic and fast overview of some key aspects of scripting with unity.
    Link: https://unity.com/how-to/learning-c-sharp-unity-beginners

    Unity Learn - official resource for learning and overall a pretty high standard of quality, although they are not good at ensuring everything is up to date so many pieces of content will not work on the latest unity version. A good baseline from which to learn some key basic skills. Not the most exciting content of the list, but very worth checking out each time you look something up.
    Link: https://learn.unity.com/tutorials

    Alan Zucconi - great tutorials going over a lot of complicated topics often delving into more in depth maths which may be good or bad depending on goals and prefered reading style. Overall a great read and a great resource if you are interested in graphics, effects and shaders
    Link: https://www.alanzucconi.com/tutorials/

    Catlike Coding - great for learning everything from basic coding all the way up to extremely advanced topics. Can go quite in depth mathematically at times which may be good or bad depending on goals and prefered reading style.
    Link: https://catlikecoding.com/unity/tutorials/

    MinionsArt - great graphics tutorials, fanastic for learning shaders and art production and some good tutorials on gameplay programming as well.
    Link: https://minionsart.github.io/tutorials/

    Ultimate unity tutorial for beginners by game makers toolkit - Relatively good for teaching newcomers how to code but glosses over a lot of important points. Overall considering the difficulty of tackling the subject matter of a "beginner crash course video" and not being a skilled or experienced developer whatsover, I think he does a good-ish job.
    Link:


    Theres plenty of others but focus on those first and you should be able to cover most topics from beginner to advanced ;)

    Good luck! :D
     
    Last edited: May 25, 2024
  4. old_school77

    old_school77

    Joined:
    Apr 29, 2024
    Posts:
    5
    The project i've been messing around with is pretty simple i think. Crouching, move left/right, jump left/right, high jump by holding up then jump, and once thats all done a simple shooting attack that can be done in crouch or standing. I've done the movement, simple jump and high jump though the two jump types aren't 100% where i need them to be.

    I've identified the major problems i have right now and have been googling different terms to get help. Stuff i need help with seems to be less popular though so i just have to keep refining my search terms or sift through all the hits. I'm starting to get the hang of thinking of what my game needs, thinking about how i would do that in the script, now its just a matter of me knowing exactly how to type that in the script.
     
    Last edited: May 25, 2024