Time for action – write your first Unity Script

Let's open our keep-up game project from the previous chapter, if it's not already open. We'll write a really simple Script and stick it to our Ball GameObject.

  1. In the Project panel, right-click/alternate-click on an empty chunk of space and navigate to Create | JavaScript as shown in the following screenshot:
    Time for action – write your first Unity Script
  2. Alternatively, you can navigate to Assets | Create | JavaScript in the menu at the top of the screen, or use the Create button at the top of the Project panel. A new Script is added to the Project panel, inviting you to type a name for it. Call the script DisappearMe. It's also a good idea to use the same Create menu to make a folder and name it Scripts, then drag your new DisappearMe script into it to keep your Project panel organized.
    Time for action – write your first Unity Script
  3. When you double-click to edit your new DisappearMe Script, a brand new window opens up. This is Unity's default Script editor (or Integrated Development Environment (IDE)), called MonoDevelop. Its main panel looks a lot like a basic text editor, because that's all that Scripts really are—plain old boring text.
    Time for action – write your first Unity Script

Tip

Rolling your own

If you have your own favorite Script editor/IDE, you can configure Unity to launch it instead. But, for the remainder of the book, we'll use the default MonoDevelop editor.