GamingCoookie / dv-multiplayer-continued

A multiplayer modification for the game Derail Valley
Other
16 stars 5 forks source link

Cache ping text and reuse transform position #30

Closed Insprill closed 1 year ago

Insprill commented 1 year ago

Two minor changes to the Update function of NetworkPlayerSync.

Firstly, instead of searching for the Ping Text component every frame, it's now cached on startup.

Secondly, a bit of a micro-optimization, instead of calling transform.position up to three times a frame, it's now cached at the beginning so it's only called once.