Here are some tips in how to create a new functionality, according to me:
- If you have something that is not so simple, write pseudo code and test it out in your mind. Make sure it works perfectly like this. I do lots of trial and error, but when I write pseudo code, I decrease the number of frustrations and time because I succeed in this.
- When there is more than just a single simple function, do each functionality one step at-a-time. Then, when you succeed, take a break.
- If you are like me, with a tendency to get obsessed with your problem until you can solve it, take a break after you have succeeded in making one functionality. I need these breaks because I my obsessions can lead me to programming over 4 hours non-stop, and it harms my health. Another thing to do with those “obsessions” is to put a serious limit in how long you will solve a problem. Set like 1 hour to solve a problem as a limit, and then take a break. Maybe, if you have worked on this for many hours, ask for help too.
- If you have a complex (or just not-so-simple) functionality (or maybe more than just a few), make them the simplest possible. I mean make the essential function, then worry about making it the way you want it when it is complete. So, for example, when I have to manipulate an important or essential variable in another script, I make it static (in my OOP) and just access it with the call of [ClassName.variableName]. This is instead of making the other classes variable private, then making extra functions/methods of calling this. It is just too complicated! This way, I don’t have go through extra trouble, and the trouble of also debugging, additional problems. Doing this mistake can also make it too difficult to differentiate between whether your main functionality is problematic or that you have made this mistake.
Another example is that, if you have something that requires a lot of math to do, then based on the correct numbers you need the feature to behave a certain way. What you do is that you create and test, the math part of your problem (which is the essential part of your problem) in simplest terms, and if you succeed in making it the way you want it, you move on on making it further.
Also Read: MY UNITY C# CODE IN HOW TO LOOP A SONG