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

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.

主站蜘蛛池模板: 当涂县| 乌海市| 农安县| 泰和县| 保康县| 宜昌市| 乌拉特中旗| 塔河县| 类乌齐县| 定边县| 金门县| 尚志市| 桑植县| 泗阳县| 石河子市| 洛扎县| 镇江市| 大关县| 昌江| 威海市| 桃园县| 黄山市| 林州市| 盐津县| 磴口县| 登封市| 三台县| 嘉义市| 蓝田县| 富顺县| 长泰县| 嘉荫县| 报价| 鸡泽县| 汾阳市| 蓝田县| 炎陵县| 桑植县| 漳平市| 达州市| 广水市|