官术网_书友最值得收藏!

Time for action - write your first Unity Script

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

In the Project panel, right-click on an empty chunk of space and choose Create | JavaScript. Alternatively, you can click on Assets | Create | JavaScript in the menu at the top of the screen, or use the Create button at the top of the Project panel. It's not a bad idea to use the same menu to create a folder that will hold all your Scripts. A new Script is added to the Project panel with the default name NewBehaviourScript.

  1. Rename the Script. Click to select it, and press F2 on your keyboard on the PC, or click on it once more to rename it on the Mac. Change the Script's name to DisappearMe.
  2. Double-click on your new DisappearMe Script. You can also select it in the Project panel and click on the Edit button in the Inspector panel.
Time for action - write your first Unity Script
  • A brand new window opens up this is Unity's default Script editor. It looks a lot like a basic text editor because that's all that Scripts really are plain old boring text. If you're a Mac user, Unity uses an editor called Unitron. If you're on a PC, Unity will launch UniSciTE.
Time for action - write your first Unity Script

Tip

Rolling your own

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

主站蜘蛛池模板: 丰城市| 图们市| 景洪市| 宝鸡市| 凉城县| 旬阳县| 清涧县| 河曲县| 庆城县| 明星| 盘锦市| 吉安县| 廉江市| 新疆| 且末县| 滁州市| 土默特右旗| 友谊县| 襄汾县| 金门县| 渝中区| 镇远县| 临桂县| 浑源县| 辽宁省| 孟村| 泸定县| 宝兴县| 泰兴市| 基隆市| 朝阳县| 濮阳市| 西青区| 明水县| 巴彦淖尔市| 秦安县| 吉安县| 东宁县| 宁城县| 敦煌市| 杭州市|