Combined Mesh (root: scene) - How can I detect if a Mesh is a static combination?

This isn’t as simple as it might sound - at least not to me!

If you make a call Resources.FindObjectsOfTypeAll(typeof(Mesh)) and you have any static batching going on, you will get back one or more meshes with the name Combined Mesh (root: scene). My understanding is that these meshes are the result of applying static batching to a scene (please shout loudly if you know differently!).

I’d like to identify this mesh as being the static combination of some other meshes, as I need to be able to treat it differently. I could consider all meshes with a name beginning Combined Mesh as static, but it does feel a bit hacky. The only thing I can see that might be useful, is that the underlying instance ID


Is negative, but firstly, I don’t know if that’s going to persist either, or just a fluke of my setup and secondly I think I’d have to use reflection to get at this ID, although that’s probably not too much of a problem.

Has anyone done this? Does anyone else have any suggestions?

Please read the question thoroughly - I am not after determining whether a gameObject is marked static.

Thanks Bovine

Yes a negative GetInstanceID() does indicate that the object was created at run time. Positive IDs will be either scene or project objects (it’s a bit of a shame that it is hard to distinguish between those two categories at runtime - though it can be done in the Editor).