It seems we have a Scene.rootCount variable, but how can we obtain a reference to the root objects of a scene?
Scene.rootObjects might be a bit problematic, for example when you reparent them. What if the LoadSceneAdditive call returns the list of objects it has loaded?
I second both of these requests. This is something that has always been strangely missing, and my guess is that those behind Unity's design are afraid of people misusing this particular feature in order to circumvent the way the engine is supposed to be used. But there are plenty of legitimate uses for it, the alternative being to use all sorts of ugly and/or dangerous hacks to work around the incomplete API. Scene.rootObjects would be a fine place to finally expose this functionality (and LoadSceneAdditive is one of several places where it makes sense to want that list of objects). As a side note, part of the reason this is such a big problem is that Unity also doesn't give us any way to check whether an object belongs to a scene or any scene. I would be fine with the addition of "bool Scene.Contains(GameObject)" or even simply "HideFlags.IsInAnyScene", as a compromise. Though Scene.rootObjects would be nicer.
Noooo. They have that already (it's part of the Transform) but the issue is that there's no efficient way to get all of the objects in a Scene (which is I rely on heavily). You have to do Resources.FindObjects<Transform>() and then check each and every Transform what scene it belongs to. We seriously need a Scene.rootTransforms. Since the new LoadScene functionality returns a Scene, that solves the request of LoadLevelAdditive returning a list of objects.
Ah, I see, they added Transform.scene. So getting all objects in a scene just went from "slow and dangerous hack" to "slow but possible and supported". Which is good enough for me, if Transform.scene works as expected. But yes, it feels very silly to be looping through all internal objects just to get at the objects in a scene. Scene.rootTransforms would be better.
I'm not sure Scene.rootTransforms would be the way to go, what if you change the parent of one of them? That is why i suggest returning the objects loaded in a scene.
If you change the parent then it's no longer in the list of root transforms. I'm not sure I see what the problem is.