Why code?

We'll write our next Script armed with some juicy knowledge. We know that GameObjects 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 GameObject to suddenly appear in response to something your player does while playing your game. What if your player can grab a power-up that displays a second paddle on the screen? In that case, that checkbox is useless to you. Your player isn't going to enjoy your game inside the Unity 3D authoring tool, and it's silly to suggest that you'll be there sitting on his lap to click that checkbox whenever he collects the Double Paddle power-up. You need to write code to tell Unity what to do when you're not there anymore. It's like equipping a baby bird with all the skills it needs to survive in the world, and then booting it out of the nest. No one's going to be around to click that checkbox for you, baby bird.