What are the basics of C#. How can i learn it and use it in unity 3d.
I think the official Scripting tutorials is a good place to start learning it. Not really super foundational (in an academic sense), but there’s more than enough in there to get you going.: Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn
Cool site to get concepts how C# works.
I recommend that you try learning from Unity tutorials and examples first and only refer to non-Unity sites in “case of emergency” ;).
The reason is: There are quite a few code practices that are taught very different in Unity and “normal” C# examples.
For example, in Unity you should not use any “foreach” loop, but always prefer a normal for-loop (to not get garbage-collector stuttering later on). But basically every non-Unity C# site teaches you foreach as “the way to go”.
Second Immanuel’s opinion on learning from Unity tutorials first.
If you want to know why I think so…
Pure C# tutorials are terribly boring and you need to get through hours/pages of tutorials before even starting to make a game. Jumping right into Unity tutorials will be more motivating. You can learn about the details once you’ve learned how to get things running and your curiosity gets the best of you. I still believe any programmer needs a good grasp of fundamentals but starting with fundamentals when you’re self-taught works for very few people.
Learning C# from Unity tutorials also helps you be familiar with Unity’s libraries and API (Mathf, Random, Vector3, Events, etc…). These are things that specific to Unity. You absolutely need to use them instead of C#/.NET’s libraries, but non-Unity tutorials obviously won’t even mention them.
The other reason is.
“Unity’s C#” is not the same as the latest and most modern C#/.NET.
It’s slightly older and behaves differently (This is because of Unity’s older compiler and an older version of their cross-platform runtime, Mono).
The old compiler means we don’t get the latest language features and shorthand which would make code cleaner.
The older runtime means it works a bit differently. This forces Unity programmers to avoid certain things for performance reasons: the Linq library, foreach, and constantly generating many small objects in general like strings.