Which objects will Unity load into memory when instantiating a prefab?

I’m about to implement a bit of random generation code, and trying to determine if it’s going to be completely wasteful.

If I instantiate a prefab, which for sake of argument has a script attached with a 100-long List of other prefabs, and then instantiates a random one, does Unity load all 100 objects into memory, or just the instantiated one?

I’ve searched the docs but can’t seem to find a definitive answer. Does anyone have enough of a working knowledge of the back end?

I assume Resources.Load is going to be a more sensible route, but thought it sensible to check since this system will be friendlier.

If you have a List with 100 gameobjects, they will be in memory.

Ok, I think this is solved.

@daveloper suggested running a Constructor test. I created a GameObject “TesterList” with a List, and added a Tester prefab to it with a script that just had a constructor with a Debug.Log(“Tester Says Hello”);

Instantiating the TesterList object calls the Debug.Log, so I guess that confirms it.

Thanks!

d