Damn it is slow.
I have a dynamic kind of prefab that when instantiating adds components to itself.
Ex: It traverse the hierarchy and adds some components to all transforms with colliders. So I don’t have to mess around with components every time I change my prefab structure.
Unfortunately when my prefabs are created I got noticeable hiccups in FPS.
I deep profile. And I see hierarchy of AddComponent chain:
GameObject.AddComponent total - 16% self 0%
GameObject.Internal_AddComponentWithType total - 16% self 5.5%
GameObject.AddComponent total - 11% self 10.8%
All this for only 120 components. (self ms 26.05)
btw. Can I somehow skip Internal_AddComponentWithType ?