Unity Helpful Tools — The Manual and Scripting API

David Hunter Thornton
4 min readAug 5, 2022

--

What do I do if I don’t understand something?

Objective: Show how to search for answers and solutions in Unity Documentation.

Since we’re starting to get into some of the more complicated coding information, I’d like to start by talking about your number 1 tool for finding solutions to your coding woes. You are welcome to bookmark it, but there is an easy way to access it.

In the top right of any tab subsection you should see a small “i” icon. If you click this, it should open a window in your default browser to Unity’s information hub. And it’ll open a page dealing directly with the subsection you selected. This is called “Unity Documentation” or “Unity Reference Manual”. This has information on basically anything you’d have a question about.

The next thing to be aware of with this site, is the “Scripting API” at the top. This will take you to a page with coding examples of how to achieve certain things.

An important note that I should mention is that you don’t want to focus too much on copying the code EXACTLY. Instead focus on the specific “syntax” or the WAY that its written. Don’t stress too much about these pages at this moment but just remember they are there if you need them.

In my last article, we discussed the method for telling an object what position you want it to be in. Let’s now breakdown telling an object to continue moving.

If you’ve already noticed, for each of the X, and Y positions in “Transform”, a positive number causes an object to move up or to the right. And a negative number causes an object to move down or to the left. This will be important in a moment.

I already know that I’m going to need the “transform.translate” code line. But since we’re talking about using this looking for answers, you should take a look through all of the options below and their descriptions to find what best suits our needs for this issue. If you take a look at the “Translate” description, you’ll see what I mean.

On this page, we can already see how part of the code line matches what we already know. In the example though, they use “Vector3.forward” and “Vector3.up”. It also has very clear notations about what each of these things mean.

The “transform.Translate(Vector3.up)” is the same as saying “transform.Translate(new Vector3(0, 1, 0));” as in our last example with Vector3. So if we code this one line into the “Update” section of our Script and save it, our square should continuously move up when we press “Play”.

As stated above, this could easily say “transform.Translate(Vector3.up)” instead. But you can also use other directions such as “.right” ,“.left” , “.down”, “.forward” , or “.back”.

Also, you can see it sorta stutter and then zoom away quickly. This is because it moves 1 meter per frame. And since my PC’s FPS (Frames Per Second) decreased right as it loaded the game, this created two visibly different speeds. We will talk about how to fix this in the next article.

Friendly Reminder: Don’t forget to keep updating your project through GitHub/Git and saving any changes you make to a separate branch. You can check out my other articles to get a breakdown of those steps! Day 1–9

--

--