- Unity 2017 Game Optimization(Second Edition)
- Chris Dickinson
- 240字
- 2021-07-02 23:21:04
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.
- Learning LibGDX Game Development(Second Edition)
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發經典名著)
- Python深度學習
- Raspberry Pi for Secret Agents(Third Edition)
- Learning Linux Binary Analysis
- PostgreSQL 11從入門到精通(視頻教學版)
- Python程序設計案例教程
- 軟件工程
- Mastering Ext JS
- 單片機應用與調試項目教程(C語言版)
- R Data Analysis Cookbook(Second Edition)
- Learning Hadoop 2
- Mastering Apache Storm
- Struts 2.x權威指南
- 寫給青少年的人工智能(Python版·微課視頻版)