Why code?

We'll write our next Script armed with some juicy knowledge. We know that Game objects are backed by code. Some of that code is invisible to us, and we can tap into it only through Scripting. Other code is exposed to us in the Inspector panel in the form of components with a GUI (like checkboxes and drop-down menus) on top.

You may already wonder why, when Unity gives us such a friendly and easy-to-use checkbox to click, we would ever want to bother writing code to do something. It's because the controls you fiddle with while you build your game are no good to you while your game is actually running.

Imagine you want a Game Object to suddenly appear in response to something your player does while playing your game. What if your player ...

Get Unity 3D Game Development by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.