Back to Writing
NOTESunitytransformperformanceoptimization

Unity Transform Optimization: Using SetPositionAndRotation

September 2, 2019Updated Feb 17, 2026

In Unity, it's common to set position and rotation separately like this:

transform.position = new Vector3(0, 0, 1);
transform.rotation = Quaternion.Euler(0f, 360f, 0f);

However, this approach triggers the internal C++ layer's OnTransformChanged message for each assignment, resulting in redundant calculations.

To reduce this overhead, Unity 5.6+ provides transform.SetPositionAndRotation():

transform.SetPositionAndRotation(
new Vector3(0, 0, 1),
Quaternion.Euler(0f, 360f, 0f)
);

Applying both position and rotation in a single call eliminates the duplicate computation overhead, which is beneficial for performance.