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

It's all Greek to me

First, we created a JavaScript script. Unity scripts are written in three languages that are somewhat like English: JavaScript, C#, and Boo. You may have already dabbled in JavaScript if you've tried your hand at web development. Unity's version of JavaScript (called "UnityScript") is a bit different because it talks about Unity-related things and runs much faster than your father's JavaScript.

In this book, we'll use JavaScript because it's the simplest of the three languages to learn. For this reason, many of the online Unity scripting tutorials you'll find are also written in JavaScript.

Tip

Stay sharp

JavaScript may be the best learning language for Unity beginners, but if you end up getting serious about developing games with this software, consider learning C#. It's much closer to a "real" programming environment, and it gives you certain organizational advantages that you won't get with JavaScript.

The first thing that we did was to write a line of code between two curly braces. I like to think of curly braces as delicious sandwich buns that group code together. The single lines of code are like the thin layers of salami or tomato in the sandwich. Above the curly braces is the description, or declaration, of the sandwich. It's like saying: We are now going to make a hoagie—top sandwich bun, yummy ingredients, bottom sandwich bun.

In more technical, less sandwich terms, the area grouped by the buns is called a statement block. The layers between the buns are called statements. And the type of sandwich we're making, the Update sandwich, is known as a function.

主站蜘蛛池模板: 凤台县| 阳城县| 西宁市| 云林县| 深水埗区| 安龙县| 巫溪县| 山东省| 沧源| 奉节县| 南京市| 河池市| 勐海县| 清徐县| 宜昌市| 宣汉县| 房产| 霍林郭勒市| 南岸区| 正定县| 长乐市| 新密市| 江北区| 陕西省| 斗六市| 习水县| 大新县| 北辰区| 久治县| 行唐县| 左贡县| 丰都县| 沙河市| 昆明市| 芜湖市| 松桃| 雷波县| 耒阳市| 扎赉特旗| 苗栗县| 揭西县|