You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's generally recommended to cache the result of expensive calls like Camera.main and GetComponent inside the Start message and avoid calling them in Update/FixedUpdate.
Proposed solution
We should detect those calls, offer to cache the result and replace the invocations by the cached field.
The text was updated successfully, but these errors were encountered:
I would recommend putting the initialisation in Awake because it runs immediately when that script instance is created instead of Start which only runs before its first update.
Also, if it is possible to offer multiple different fix suggestions then it might be useful to have one for lazy initialisation rather than moving it to Awake:
It's generally recommended to cache the result of expensive calls like
Camera.main
andGetComponent
inside theStart
message and avoid calling them inUpdate
/FixedUpdate
.Proposed solution
We should detect those calls, offer to cache the result and replace the invocations by the cached field.
The text was updated successfully, but these errors were encountered: