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

Click Play!

Quite an exciting moment! Go back from MonoDevelop to Unity and click the Play button. Unity should print out two lines on the Console tab, looking like this:

Unity executed the code in the variableScript component on the GameObject just after you clicked Play. We can see two lines printed on the Console window. We wrote a piece of code asking Unity to print these two values the Console window. Let's look again at lines 11 and 13. Everything inside the brackets in the Debug.Log function will be printed to the Unity Console. It can be a number, text, or even an equation:

So, line 11 is asking, "Hey Unity, print the result of 2 + 9 on the console!" Line 14 is using the myNumber variable's value directly and adding it to the number 11.

Thus, the point of this exercise is to demonstrate that you can store and use whatever values you want using variables, and use their names directly to perform operations.

主站蜘蛛池模板: 弥渡县| 阿坝县| 伽师县| 安达市| 宁国市| 凉城县| 伊吾县| 中方县| 云霄县| 秦皇岛市| 左贡县| 宁乡县| 二手房| 鄂州市| 绥滨县| 亚东县| 南丰县| 湾仔区| 宝清县| 水富县| 江阴市| 宜宾县| 乐陵市| 新干县| 济源市| 兴和县| 南昌市| 安阳县| 清新县| 临漳县| 福安市| 淮滨县| 嘉鱼县| 中方县| 仙桃市| 凤阳县| 巩义市| 筠连县| 南投县| 建湖县| 习水县|