All project as child of one gameObject is a good idea?

I was looking the different ways to get a prefab reference. And I want to know which is the best way for performance.
I know 4 for the moment:

The first one is use gameObject.Find (I think this is the worst for performance).

The second one is to create a public GameObject and use the drag and drop in the inspector.

The third one is use the resources folder and call it directly but I read that is better to don’t use this method too much.

And the last one is my last idea: Create a gameObject as a parent of all the elements in the scene and find each gameObject using GetChild().


The context of usage of the prefab really dictates the optimum method to use. If a prefab is used for bullets and casings on a weapon, you want quick access so you keep a reference handy at all times because the prefab is used throughout the game.

If the prefab is a fixture, say the typical example light pole, then you’re using the prefab during initialization of the scene. If there’s only 1, a find isn’t going to be that heavy, and you’ll re-use a reference for subsequent multiple instantiations (you definitely don’t want to execute find inside a loop for each instantiation).

So, from your title, the notion of your last idea is confusing. Do you contemplate the entire project is a prefab? I don’t know that I understand what that’s getting at. Whatever means you use to find objects, the larger the number the slower the performance. Typically, if we are still talking about prefabs, you’ll have some objects that are prefabs, then everything else that isn’t. If you want the prefabs in the scene (and, really, what is a prefab but something you’re going to duplicate), perhaps what you want to do is create an empty GameObject as a node that contains all the prefab options, so when you search the code only searches through prefab options and not all objects in the scene.

That said, there’s no real obstacle to putting everything as a child of some uber parent if you have reason. I did that in one case during an experiment after importing a model of lots of meshes comprising the artwork for a scene that required scaling. I placed everything as a child of an empty GameObject, which let me scale everything in one step. It worked fine, but the volume ‘low-medium’ - about 8,000 facets overall, with some 500 objects inside.