Performance: Unity Editor interface
The Unity Editor interface affects the responsiveness and load time of the editor itself, impacting how quickly developers can interact with scenes and assets.
public class MyEditorWindow : EditorWindow { Vector2 scrollPos; void OnGUI() { scrollPos = GUILayout.BeginScrollView(scrollPos); for (int i = 0; i < 100; i++) { GUILayout.Label("Item " + i); } GUILayout.EndScrollView(); } }
public class MyEditorWindow : EditorWindow { void OnGUI() { for (int i = 0; i < 1000; i++) { GUILayout.Label("Item " + i); } } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Rendering 1000 UI labels every frame | 1000 UI elements processed | 1000 layout recalculations | High paint cost due to many draw calls | [X] Bad |
| Rendering 100 UI labels inside a scroll view | 100 UI elements processed | 100 layout recalculations | Moderate paint cost | [OK] Good |
public class Player : MonoBehaviour {
public float speed = 5f;
}Pass the test and this pattern moves unknown