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

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.

主站蜘蛛池模板: 衡阳县| 三都| 遵义县| 凯里市| 常山县| 盐源县| 廊坊市| 金坛市| 海南省| 满洲里市| 长治县| 象州县| 抚顺市| 东明县| 元朗区| 长乐市| 扶绥县| 岚皋县| 天水市| 石景山区| 晋城| 无锡市| 莱西市| 诸暨市| 古交市| 汉川市| 依安县| 即墨市| 五大连池市| 延津县| 嘉善县| 西城区| 余庆县| 崇义县| 横山县| 高淳县| 丰顺县| 津南区| 余江县| 思茅市| 噶尔县|