you learn extra new commands, methods and functions as a newbie and it turns out you fully reinvented wheel for 6 months, and it all can be replaced with far superior built-in function. You aren’t mad, you’re actually happy as you whizz by weeks of progress in matter of hours.
With time spared I shall buy my burnt braincells back.
For whatever reason, I didn’t think GetComponentInParent() existed for the longest time, and I have no idea why. I used GetComponentInChildren() all the time, but when it came to getting a component from a parent object, I would always write my own method of checking the current object and moving up the hierarchy repeatedly until the root object was reached, all while thinking “Man, I wonder why Unity doesn’t have a built-in method of doing this.”
It was only while scrolling through the docs one day that I noticed GetComponentInParent(), and I just felt a wave of something I can only describe as the universe telling me, “you dumb dumb”.
Back when I first started using Unity I wrote a whole system to instantiate materials so that I could change the material properties on one object without affecting the other objects that also had the same material. Shortly after I completed and tested my system I found out that Unity does this automatically.
Every so often I have this happen to me, but it’s usually because I’m just stumbling around in the API, trying to figure out how some undocumented function works.
As an old habit, one of the first things I do when I learn a new framework/API/Tool/Library/etc, is read through the entire scripting reference. Not for retention, and not every note/paragraph, but all the classes and methods. Then once you start learning it, and need to do something, you may recall reading something about that and know where to look and, indeed to look.
Whenever I am doing some mindless task that doesn’t require full concentration, I get some tutorials playing in the background. Even if its stuff I think I already know how to do, I almost always pick up some nice little tip like that. That’s why its so good to learn the same thing from as many people as you can. Even though experienced pros are the best, I’ve picked up some really good nuggets from other beginners/semi-pro’s.
Unity is awesome…just assume it has everything you need whether its a built in functionality or an asset store asset. All you gotta do is search for it. Works for me. If you can’t find what you need, just google and there’s probably some Unity answer somewhere that points you in the right direction. No need to even make a new post.
Among the 500 functions and methods? I only type what I know, I don’t look at IntelliSense for completion, I look for verification whether the variable exists and as in the scope.
That’s something you learn with experience, I often have a hunch a built in method exists and often it does. If it does not I check the reference manual
The beautiful thing about intellisense/linters is they sort and suggest things based on what you’re typing… so if you’re referencing an instance of a class type its only gonna display the functions/available methods & variables for that class on that instance.
Same for static classes. If you’re typing a reference to a static class, it can and it should display every member available for that class and its superclass(es)… and in most cases the linter gives you an idea of whats wrong with your syntax.
They are amazing tools, really. Linters will give you a subset of the entire API’s methods…
HMM. This is not a help forum but that is because transform.position is a Vector. Vector3’s and Vector2’s are structs, and are entirely interchangeable. You can implicitly cast between them if I’m not wrong, but with potential for loss of information.