Give priority to scalar calculations over vector calculations

Hi,
I’m just sharing here a good practice (no impact for this course):

When working in tight loops or performance-critical sections, remember that scalar math is faster than vector math.

I would replace:
transform.position += moveDirection * moveSpeed * Time.deltaTime;
by
transform.position += moveSpeed * Time.deltaTime * moveDirection;

Source

10 Likes

Yup, good tip!

Privacy & Terms