Unity: Static Batching Timing

An interesting, undocumented aspect of static batching in Unity: static batching occurs between Awake and Start. Objects in the hierarchy at that point will batch; anything created later will not.

This is true even when loading scenes additively. If as the additional scene is loaded in Awake(), and the additional scene contains a script instantiating objects in its Awake(), those objects will undergo static batching if they’re otherwise eligible. If the scene is loaded in Start(), or the instantiation occurs after Awake(), they won’t. There are lots of weird timing issues with additive scene management, but this, at least, seems to work as expected.

I hope that this saves someone out there the hour or so it took us to figure out when we needed to be instantiating environmental objects. 😉


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s