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

Verifying script count

If we’re looking at our Profiler data and note that a certain MonoBehaviour method is being executed more times than expected, or is taking longer than expected, we might want to double-check that it only occurs as many times in the Scene as we expect it to. It’s entirely possible that someone created the object more times than expected in the Scene file, or that we accidentally instantiated the object more than the expected number of times from code. If so, the problem could be due to conflicting or duplicated method invocations generating a performance bottleneck. We can verify the count using the same shortlist method used in the Best approaches to performance analysis section.

If we expected a specific number of Components to appear in the Scene, but the shortlist revealed more (or less!) than this, then it might be wise to write some initialization code that prevents this from ever happening again. We could also write some custom Editor helpers to display warnings to any level designers who might be making this mistake.

Preventing casual mistakes such as this is essential for good productivity, since experience tells us that if we don't explicitly disallow something, then someone, somewhere, at some point, for whatever reason, will do it anyway. This is likely to cost us a frustrating afternoon hunting down a problem that eventually turned out to be caused by human-error.

主站蜘蛛池模板: 吴桥县| 舒兰市| 当阳市| 青田县| 凌源市| 太湖县| 许昌县| 无锡市| 贵阳市| 抚宁县| 斗六市| 湖南省| 诸城市| 乌拉特前旗| 法库县| 普洱| 朝阳市| 监利县| 彩票| 建平县| 鸡泽县| 平乡县| 甘谷县| 兴安县| 沭阳县| 普洱| 元谋县| 砚山县| 沙湾县| 保定市| 溆浦县| 玉溪市| 达州市| 乌兰察布市| 耿马| 孟村| 花莲县| 雷山县| 嘉义县| 若羌县| 杭锦旗|