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

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.

主站蜘蛛池模板: 象州县| 江油市| 开平市| 简阳市| 泰顺县| 雷波县| 崇礼县| 武宣县| 富平县| 长岛县| 阿坝县| 呼和浩特市| 宜川县| 通州市| 信丰县| 乐山市| 玉屏| 宁化县| 雷州市| 社旗县| 扶绥县| 南澳县| 泗阳县| 邹平县| 济宁市| 灌阳县| 清新县| 荣成市| 常山县| 靖西县| 开远市| 湄潭县| 聂荣县| 正安县| 连江县| 铁岭市| 灯塔市| 柏乡县| 育儿| 浪卡子县| 方城县|