I seriously cannot learn how to script. What do I do?
The main thing I struggle with in Unity is using C# to script. Every time I look up a video tutorial, it is either incredibly basic or incredibly difficult (i.e. someone defining a variable versus someone making a full game at a very fast pace). When I see other people with this same problem, the community always answers with "you should just try to do something and learn scripting relative to that instead of just mindlessly doing tutorials"; this doesn't work either! I literally spent 9 1/2 hours one weekend trying to get grid-based movement in my 2D game with no success because I have no idea what I'm doing! When I go on the forums people provide me with advice that goes over my head. The only thing preventing me from learning how to make games is a fundamental understanding of how to script in C#. How do I get there?
I am now a very fast and efficient programmer. what you are describing is something i went through too for many months when i started. getting frustrated is just part of the learning process. learning program$$anonymous$$g is not easy. when i started i would just try to write scripts a very little bit at a time.
But that's exactly the point. You spent month, he spent 9.5 hours. I started leaning program$$anonymous$$g at the age of 11. Now 22 years later I'm still learning something new almost on a daily basis. Yes, it would be nice if we lived inside the $$anonymous$$atrix and could just download some knowledge into our brains, however that's not how the world works.
Answer by TharosTheDragon · Oct 04, 2017 at 04:32 PM
If you want to take the most leisurely route, you can start learning programming concepts with an easier language. Languages like Basic exist for this purpose.
I also recommend taking actual C# classes and reading actual C# books rather than just doing tutorials. Just keep in mind that there are some differences between how Unity uses C# and how C# is typically used (with the .NET framework). But since you seem to have a good grasp of Unity apart from the C# scripting, I think you'll be all right.
I'm actually just started my Computer Science major and I'm learning C++ right now. Do you think if I'm patient I'll start to grasp the concepts in C# in Unity better?
If you're majoring in computer science then I would think you'll be taking the kinds of classes that will help you, yes. I think C++ may be the most difficult language out there, and it's certainly harder than C#.
I wouldn't say C++ is the most difficult language... Have you ever tried assembler? After writing my own OS in assembler on a 8086 CPU, C++ is a breeze.
I think you mix the difficulty / complexity of a language with the difficulty / complexity of achieving a certain goal in that language. The 8086 assembler is very simple and straight forward. When program$$anonymous$$g assembler you usually struggle the most with hardware specific stuff. You have to know the hardware on a very low level. However that's not part of the language, it's part of the problem you want to solve.
While C++ abstracts a lot of the basic hardware layer stuff (hence we call it a high level language) the language itself is several factors more complicated than assembly. There are some language features (templates is one of them) which allows you to create such complicated structures it's almost imposslbe to actually understand what you're doing. $$anonymous$$ulti-base class inheritance can also be quite confusing at times.
Answer by Kishotta · Oct 04, 2017 at 05:05 PM
A lot of people get stuck in this spot (there's probably a name for it at this point) in their programming adventure where they can readily read and understand most code you put in front of them, but they aren't able to create the code themselves.
I'm convinced this is due to the misconception on how the programming workflow should actually work. My compsci teachers, throughout my degree program, asserted that programmers spend ~90% of their time THINKING about writing code. Breaking down your problem into simpler ones, figuring out which structures and patterns work best, naming things, justifying decisions. Then once the general idea is all fleshed out (if not for the whole program, at least for a single module or class), you can worry about the details of how exactly to write it all down when you sit down to code.
This approach has worked pretty well for my classmates and I.
Maybe that workflow isn't conducive to gamedev. I'm really not sure. As far as learning your language of choice (this applies to pretty much any language), so long as you have the basic concepts of programming understood (variables, flow control, inheritance and polymorphism if using OOP, lamdas, callbacks, etc.), reading the language specification/documentation can answer TONS of questions.
I'm finishing my degree this semester and just last night I had to look up "c++ stoi" because I could't remember what value was returned when you try to convert an empty string ""
to an integer. You'll never know it all. You'll always need a reference (or stackoverflow/unityanswers). Don't feel too bad about it.
Whew, that was longer than I meant it to be. Sorry if it's not helpful.
Answer by archieval23 · Oct 04, 2017 at 05:26 PM
First things first. Read and understand the documentation of Unity It will help you understand what will you do in your codings Link of Documentation below https://docs.unity3d.com/Manual/index.html
Answer by SFoxx28 · Oct 04, 2017 at 05:08 PM
Learning C# really does consist of the basics of what are variables, objects, classes, and other concepts. After you learn the basics try reading other people's code and understand what it does and how it works one line at a time. Then try to mimic that in your code. TBH I'm still learning a lot about programming in Unity3D C# and there many advanced concepts I need to learn. But my advice is after you grasped the basics that those tutorials provide, dive right in and refer back to those tutorials if you get stuck or ask for help.
Also, if programming is a challenge for you then you may want to look into Unity Playmaker as an alternative. You can find it in the asset store. It allows you to code via blueprints without ever writing a single line. I tried it myself and thought it was handy but there's still a learning curve. I come from a programming background and between Playmaker and writing C# myself I prefer C# as a personal preference.
Your answer
Follow this Question
Related Questions
Rotate Player 90 degrees about its Y axis relative to the mouse being dragged between two angles 1 Answer
How to tell if the code flow changed 2 Answers
Attaching sound to ImageTarget issues 0 Answers
Collision Detection Not Working (Unity 5.2.3) 5 Answers
Should I inherit from Monobehaviour if the use of my C# script is only to hold script references? 2 Answers