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

Improving our scripts with attributes and XML comments

We could stop working with the PlayerBehaviour class script here, but I want to touch on a couple of things that we can use in order to improve the quality and style of our code. This becomes especially useful when you start building projects in teams, as you'll be working with other people--some of them will be working on code with you, and then there are designers and artists who will not be working on code with you, but will still need to use the things that you've programmed.

When writing scripts, we want them to be as error-proof as possible. Making the rb variable private starts that process, as now the user will not be able to modify that anywhere outside of this class. We want our teammates to modify dodgeSpeed and rollSpeed, but we may want to give them some advice as to what it is and/or how it will be used. To do this in the Inspector window, we can make use of something called an attribute.

主站蜘蛛池模板: 石屏县| 沿河| 株洲市| 博乐市| 儋州市| 怀远县| 贵定县| 溧阳市| 松桃| 阜宁县| 榆社县| 常宁市| 六枝特区| 左权县| 陵川县| 建平县| 邵阳县| 迭部县| 宝清县| 公安县| 合山市| 左权县| 高淳县| 砀山县| 金湖县| 栖霞市| 商河县| 华阴市| 玉溪市| 江源县| 历史| 迁西县| 静海县| 搜索| 大邑县| 雷州市| 灌南县| 卓尼县| 韩城市| 万山特区| 定南县|