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

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.

主站蜘蛛池模板: 宁远县| 台山市| 安徽省| 上杭县| 乌拉特中旗| 濮阳县| 宣化县| 留坝县| 垦利县| 班玛县| 黎川县| 九龙坡区| 太仆寺旗| 庆云县| 襄樊市| 宾川县| 柯坪县| 杭锦后旗| 清水河县| 万安县| 沈丘县| 宁海县| 孝感市| 友谊县| 荣成市| 蒙城县| 镇巴县| 思南县| 益阳市| 泗水县| 松江区| 乡宁县| 彝良县| 万安县| 读书| 新津县| 扶余县| 二手房| 颍上县| 宁武县| 万州区|