Optimizations - Unity-Technologies/EndlessRunnerSampleGame GitHub Wiki

The code walk-through on the Unity learn website contains multiple information on some optimization in the game

CurvedRotation

Rotation of the collectibles is made through a vertex shader and not through script or an animator for performance reasons.

A script on each collectible will increase the number of script to run. We could reduce that by using a manager : only it is updated once and make all collectibles it store a reference to spin. But that still create performance problem because we update a lot of Transforms which is costly (especially since they are deep in hierarchy as they need to be attached to the moving Track Segments)

An animator also have a running cost and also have some "hidden" cost when being enabled, which is something we do every time we place a new collectible.

A shader is the most efficient : it is running in parallel, and only had a couple of multiplication to a computation it already need to run.

The drawback is that we need to disable batching for collectibles ( "DisableBatching" = "True" in the Shader tags) as otherwise they would spin around the combines meshes origin instead of their own