General Optimizations Flashcards

1
Q

Address Properties by ID

A

Unity does not use string names to address Animator, Material and Shader
properties internally. For speed, all property names are hashed into property IDs, and it is these IDs that are actually used to address the properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Use non-allocating physics APIs

A

Replace RaycastAll calls with RaycastNonAlloc, SphereCastAll calls with SphereCastNonAlloc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Find and FindObjectOfType

A

It is a general best practice to eliminate all usage of Object.Find and Object.FindObjectOfType in production code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Camera locators

A

Internally, Unity’s Camera.main property calls Object.FindObjectWithTag, a specialized variant of Object.FindObject.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Debug code & the [conditional] attribute

A

The UnityEngine.Debug logging APIs are not stripped from non-development builds, and do write to log files if called. As most developers do not intend to write debug information in non-development builds, it is recommended to wrap development-only logging calls in custom methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly