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

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.

主站蜘蛛池模板: 化州市| 武胜县| 临高县| 河东区| 仁寿县| 福州市| 阿克苏市| 竹山县| 阿瓦提县| 庄河市| 贵州省| 徐水县| 广东省| 武胜县| 玛纳斯县| 桦南县| 贵阳市| 财经| 舒城县| 会理县| 岳普湖县| 金秀| 法库县| 南川市| 巫山县| 仲巴县| 伽师县| 措美县| 漳州市| 营口市| 峨山| 遵义市| 田阳县| 吉安县| 濮阳市| 清徐县| 景谷| 湘潭市| 友谊县| 清涧县| 安阳市|