So I’ve been profiling my game and I noticed some calls to Transform.GetScene.
As far as I was able to pin down it happens when I change the Render.enabled property.
But from what I see my renderers are all on the currently active scene. Also I didn’t find any mention of this method anywhere.
Anyone know what that is and is it possible to do something to remove that call?
@Casiell This is an older thread and probably too late for the OP, but I’m also seeing the same. I’ve only been looking at it for a few minutes, but in my case it appears to also make a Transform.GetScene call for each collider attached to a gameObject - either when the collider is being enabled itself (unconfirmed), or when the gameObject as a whole is being enabled. There are additional Transform.GetScene calls for each child object when the parent gets enabled as well.
It’s at least part of why having a runtime hierarchy be as flat as possible is important, among other reasons. Otherwise disabling a parent gameObject will traverse all child objects, kicking off all sorts of processes including Transform.GetScene, for each of the relevant children.
It’s not possible to completely remove it, but flattening out the hierarchy will reduce it.