I don’t know if anyone else has this problem but the whole Unity documentation site causes me nothing but headaches whenever I visit there for help and I always end up searching the answers section or watching youtube instead of being able to find it myself.
For example. I wanted to simply play the animation attached to a gameobject when a button was pressed.
This is the line of code I used. I know this works. I had to watch youtube to get it. But I know for a fact this is the correct line of code for the job.
does it tell you to write that line of code. It doesn’t say why you write GetComponent. It doesn’t say why you put Animation in the two weird arrows <>. It doesn’t say why there is two empty brackets or what they do. or to put .Play followed by more empty brackets.
Somebody please tell me the secrets of reading this damn Unity Documentation.
You’re reading the Scripting API, when what you’re looking for is a tutorial on C# (for understanding Generic syntax, which is what the brackets are), and on basic Unity scripting (which would explain usage of GetComponent). And then maybe one about the animation system in particular.
The Scripting API isn’t a “learn how to do X” guide, it’s a “I basically know how to do X, but I forget which function to use / what the parameters are” reference.
What your real problem is is not understanding the basics of C# and Unity’s component system. You really should do the learn tutorials in the scripting section first, before diving into the API.
Once you do dive into the API, read Transform, MonoBehaviour and GameObject in detail. These three classes are central to Unity development, and you won’t get far without understanding them.