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

Changing a property's value in the Inspector panel

There are two situations when you can modify a property value:

  • During the Play mode
  • During the development stage (not in the Play mode)

When you are in the Play mode, you will see that your changes take effect immediately in real time. This is great when you're experimenting and want to see the results.

Write down any changes that you want to keep because when you stop the Play mode, any changes you made will be lost.

When you are in the development mode, changes that you make to the property values will be saved by Unity. This means that if you quit Unity and start it again, the changes will be retained. Of course, you won't see the effect of your changes until you click on Play.

The changes that you make to the property values in the Inspector panel do not modify your script. The only way your script can be changed is by you editing it in the script editor (MonoDevelop). The values shown in the Inspector panel override any values you might have assigned in your script.

If you wish to undo the changes you've made in the Inspector panel, you can reset the values to the default values assigned in your script. Click on the cog icon (the gear) on the far right of the component script, and then select Reset, as shown in the following screenshot:

Displaying public variables in the Inspector panel

You might still be wondering what the word public at the beginning of a variable statement means:

public int number1 = 2;

We mentioned it before. It means that the variable will be visible and accessible. It will be visible as a property in the Inspector panel so that you can manipulate the value stored in the variable. The word also means that it can be accessed from other scripts using the dot syntax.

主站蜘蛛池模板: 芒康县| 宜君县| 芒康县| 故城县| 米易县| 深水埗区| 梅州市| 博客| 丹阳市| 钟祥市| 潮州市| 广汉市| 潮州市| 富源县| 江口县| 元谋县| 栾城县| 辉南县| 舞钢市| 海南省| 岑溪市| 青神县| 汉源县| 临湘市| 汶上县| 嵊泗县| 灵璧县| 梨树县| 双江| 塔城市| 日喀则市| 句容市| 土默特右旗| 山阴县| 江口县| 车险| 梅州市| 榆社县| 长垣县| 福泉市| 大安市|