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

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.

主站蜘蛛池模板: 福建省| 温州市| 衡南县| 石柱| 城固县| 四会市| 乌鲁木齐县| 芒康县| 永新县| 桐梓县| 怀远县| 油尖旺区| 合川市| 石景山区| 靖西县| 股票| 阳东县| 沙田区| 沁水县| 连云港市| 衡阳市| 长乐市| 郓城县| 舒城县| 广河县| 寻甸| 新疆| 荣成市| 罗甸县| 昆明市| 兴文县| 昌宁县| 延长县| 新丰县| 沾化县| 铁岭市| 平山县| 潞西市| 济宁市| 勐海县| 石首市|