Skip to content

Performance critical context and costly methods

Vladimir edited this page Dec 7, 2018 · 11 revisions

Performance critical context

Unity methods like Update, LaterUpdate, FixedUpdate, etc are called each frame, so these methods can affect performance of your game.

Rider will highlight these methods and each method which is reachable from them via line markers on gutter (you can disable it in Unity plugin settings, also you can change color for highlighting in our common settings). Together these methods make up the performance critical context. Highlightings will help you to understand that you should be careful when writing code and try not to invoke costly methods inside performance critical context.

Costly methods

Rider will highlight well-known costly methods in performance critical context:

  1. AddComponent<MonoBehaviour> invocation
  2. Invocation of Find methods
  3. Invocation of GetComponent methods
  4. String based method invocation
  5. Camera.Main usage
  6. Null comparisons against UnityEngine.Object subclasses
Clone this wiki locally