Reader small image

You're reading from  Learning C# by Developing Games with Unity - Seventh Edition

Product typeBook
Published inNov 2022
Reading LevelBeginner
PublisherPackt
ISBN-139781837636877
Edition7th Edition
Languages
Tools
Right arrow
Author (1)
Harrison Ferrone
Harrison Ferrone
author image
Harrison Ferrone

Harrison Ferrone is an instructional content creator for LinkedIn Learning and Pluralsight, tech editor for the Ray Wenderlich website, and used to write technical documentation on the Mixed Reality team at Microsoft. He is a graduate of the University of Colorado at Boulder and Columbia College, Chicago. After a few years as an iOS developer at small start-ups, and one Fortune 500 company, he fell into a teaching career and never looked back.
Read more about Harrison Ferrone

Right arrow

Exploring the documentation

The last topic we’ll touch on in this first foray into Unity and C# scripts is documentation. Not sexy, I know, but it’s important to form good habits early when dealing with new programming languages or development environments.

Accessing Unity’s documentation

Once you start writing scripts in earnest, you’ll be using Unity’s documentation quite often, so it’s beneficial to know how to access it early on. The Reference Manual will give you an overview of a component or topic, while specific programming examples can be found in the Scripting Reference.

Every GameObject (an item in the Hierarchy window) in a scene has a Transform component that controls its Position, Rotation, and Scale. To keep things simple, we’ll just look up the camera’s Transform component in the Reference Manual:

  1. In the Hierarchy tab, select the Main Camera GameObject.
  2. Move over to the Inspector tab and click on the information icon (question mark, ?) at the top right of the Transform component:

Figure 1.21: Main Camera GameObject selected in the Inspector

  1. You’ll see a web browser open on the Transforms page of the Reference Manual:

Figure 1.22: Unity Reference Manual

All the components in Unity have this feature, so if you ever want to know more about how something works, you know what to do.

So, we’ve got the Reference Manual open, but what if we wanted concrete coding examples related to the Transform component? It’s pretty simple—all we need to do is ask the Scripting Reference:

  1. Click on the SWITCH TO SCRIPTING link underneath the component or class name (Transforms, in this case):

Figure 1.23: Unity Reference Manual with the SWITCH TO SCRIPTING button highlighted

  1. By doing so, the Reference Manual automatically switches to the Scripting Reference:

Figure 1.24: Unity scripting documentation with SWITCH TO MANUAL

  1. As you can see, as well as coding help, there is also an option to switch back to the Reference Manual if necessary.

The Scripting Reference is a large document because it has to be. However, this doesn’t mean you have to memorize it or even be familiar with all of its information to start writing scripts. As the name suggests, it’s a reference, not a test.

If you find yourself lost in the documentation, or just out of ideas regarding where to look, you can also find solutions within the rich Unity development community in the following places:

On the other side of things, you’ll need to know where to find resources on any C# question, which we’ll cover next.

Locating C# resources

Now that we’ve got our Unity resources taken care of, let’s take a look at some of Microsoft’s C# resources. For starters, the Microsoft Learn documentation at https://docs.microsoft.com/en-us/dotnet/csharp has a ton of great tutorials, quick start guides, and how-to articles. You can also find great overviews of individual C# topics at: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/index.

However, if you want detailed information on a specific C# language feature, the reference guides are the place to go. These reference guides are an important resource for any C# programmer, but since they aren’t always the easiest to navigate, let’s take a few minutes to learn how to find what we’re looking for.

Let’s load up the programming guide link and look up the C# String class. Do either of the following:

  • Enter Strings in the search bar in the top-left corner of the web page
  • Scroll down to Language Sections and click on the Strings link directly:

Figure 1.25: Navigating Microsoft’s C# reference guide

You should see something like the following for the class description page:

Figure 1.26: Microsoft’s Strings (C# Programming Guide) page

Unlike Unity’s documentation, the C# reference and scripting information is all bundled up into one, but its saving grace is the subtopic list on the right-hand side. Use it well! It’s extremely important to know where to find help when you’re stuck or have a question, so be sure to circle back to this section whenever you hit a roadblock.

Previous PageNext Page
You have been reading a chapter from
Learning C# by Developing Games with Unity - Seventh Edition
Published in: Nov 2022Publisher: PacktISBN-13: 9781837636877
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Harrison Ferrone

Harrison Ferrone is an instructional content creator for LinkedIn Learning and Pluralsight, tech editor for the Ray Wenderlich website, and used to write technical documentation on the Mixed Reality team at Microsoft. He is a graduate of the University of Colorado at Boulder and Columbia College, Chicago. After a few years as an iOS developer at small start-ups, and one Fortune 500 company, he fell into a teaching career and never looked back.
Read more about Harrison Ferrone