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

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.

主站蜘蛛池模板: 西贡区| 温宿县| 农安县| 宁都县| 崇礼县| 西青区| 石门县| 阿拉善右旗| 芮城县| 凤山市| 阳新县| 灌云县| 凤庆县| 太仆寺旗| 临洮县| 方城县| 彩票| 宁明县| 灌南县| 丹阳市| 张家界市| 高邑县| 遂平县| 青铜峡市| 德州市| 水富县| 黄大仙区| 花莲县| 蒙城县| 江油市| 保靖县| 洪湖市| 海门市| 萝北县| 南平市| 湛江市| 会同县| 汶上县| 镇平县| 平遥县| 乃东县|