Best way to learn to programming with csharp in terms of unity

I don’t know where to look to learn how to use csharp,

I was wondering how everyone else learned to use it to program games?

Unity has tutorials on scripting in C#. Below is the link to them but they can also be found by clicking on Learn at the top of the website, followed by clicking Tutorials, then clicking Scripting. They have other topics as well though so I recommend checking out the different categories as you need them.

My method was to go through the MSDN documentation covering the basics of the language. I don’t recommend that approach though unless you’re already an experienced developer as it assumes you already understand programming concepts.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/

Step 1. Lookup code example in Unity - Scripting API:
Step 2. Apply code in your project
Step 3. Fix Errors.
Step 4. Goto Step 1.

Eventually you can code anything you want with this method…

1 Like

I’d recommend doing tons of tutorials until you get a hang of the language; asking questions on the forums is a great way to learn what you don’t know.

Unity’s tutorials are good for beginners, I liked the Roll a Ball tutorial the most.
Also check out these: Unity C# and Shader Tutorials

I also like Dot Net Perls for examples on how to use different aspects of C# because their examples are very in-depth and well explained: https://www.dotnetperls.com/
YouTube has some great tutorials; Brackey’s are some of the best.

Many people will recommend just reading documentation, but I think a tutorial-based approach is better for newbies. Once you know the basics, you’ll be able to look in the docs and understand how to use the code.

1 Like

I dove in. I broke stuff. Most of it never got fixed. I moved on and broke other things. Over time I got pretty good at not breaking things.

I’m just saying: don’t be afraid to dive in head-first and make a ton of mistakes. The beauty of programming is that there are a million ways to make the math turn out exactly the same.

Edit: I should note I am not trying to steer you away from tutorials whatsoever, just suggesting that experience is a great teacher.

3 Likes

I think finding an ideal balance between the theory and practice could be a very important factor in learning a programming language.

So, I’d suggest making a lot of small programs and try to actually understand why they work that way. The worst way to learn programming could be searching for a working example on internet and copy & pasting without actually understanding it. Avoid such tutorials that only tell you about the ‘how’ part, and try to find those which also explain the ‘why’ aspect.

You’ll need a bit of programming theory and other common knowledges too. You don’t have to read a lot of books before actually going into actually writing code, but some basic knowledge about object oriented paradigm, or refactoring could help, and at least read about common coding conventions and best practices, so you won’t make such a mistake as Unity people did in ignoring the capitalization convention in declaring methods or properties :p.

Also, try to spend some time to learn your IDE. Some IDEs or plugins are so powerful that they not only make it much easier to write code, they can also teach you how to write code properly. For example, I started to use C# recently and later moved over to C# 7, and Rider (ReSharper in VS.net offers similar functionalities) has pretty much taught me how to do that, so I could get familiar with the language pretty quickly.

And lastly, programming languages or anything that are related to them are evolving pretty fast. So, you might want to find a few websites where you can hear about the latest trend.

2 Likes

If you are completely new to programming, look up the Microsoft Virtual Academy course called C# for Complete Beginners.

It will teach you the fundamentals of the languages syntax in a very easy to understand manor.

I first started with tutorials, but I found that I never really understood what I was doing until I took a step back and completed that course.
The syntax is really pretty simple, but if you don’t take a little time to get it down, that may make your learning process more frustrating than it has to be.

1 Like

Tutorials and courses are great, but there’s one fundamental key element you got to always have:
Make sure you know where you want to go by learning C-Sharp for Unity.

You can watch hundreds of videos, read dozen of books and even be coached by some pros and still not understanding anything like if nothing is registering in your brain.

I will tell you this, first thing you got to do to learn how to script C-Sharp is to put a long-range goal to your learning course.
What do you want to learn C-Sharp for? If it’s anything too remotely clear like “I want to be able to script my games”, you won’t learn anything easily.

Instead, think of some kind of game you want to build. Maybe you want to build a platform game or a simple RPG. A card game perhaps? A shooter? Maybe a racing game! Anything else? From this, you set your goal and look for tutorial related to that particular project. You’ll hit your head many times, but every times you’ll learn something new.

Before being at the point where I’m currently am, over the last 2 years, I have build at least 2 fully functional prototypes for every main types of games. Some focus more or less on UI, physics, events, animations, etc.

Don’t ever fall into the pit of watching any Tutorial just for the sake of learning about C-Sharp in general. That’s like taking general cooking focusing on every types of food to become a Pastry chef.

Already knew other languages so it was trivial to switch to. But if it is your first language, please understand the best learning you do, is by doing.

I started in the 90’s with an old 5 1/4" floppy pc with no hard drive, and a book on DOS that I read cover to cover. It wasn’t quite coding but it gave me the intense desire to learn. Then the internet came around with forums that could teach me any language I wanted to learn. I asked questions. Tons of them. Learned pascal. Learned visual basic. Kept right on doing that with forums, language after language. Now I’ve been fluent at one point or another in something like 27 coding languages. Haven’t touched a book since the 90’s.

It’s probably different for everybody but for me forums and experience are what taught me. I failed a lot and but kept on going. Do that enough and eventually you’ll have fewer and fewer failures and the ability to fight your way through hundreds of bugs and errors and rarely have to ask or search for help. Once you know one or two languages it becomes much easier to learn others, kind of like musical instruments. They’re all basically the same on a fundamental level.