Hey, all,
I just wanted to check something so I know I’m not being an idiot.
If I have an array, like so:
public GameObject[] Enemies;
which I then stock with prefabs from the library (which DON’T exist in the scene), are these objects loaded into memory, or just kept as references to the prefabs?
In other words, if the prefabs I drag to the array in the editor are large objects with multiple materials, do they take up memory in my scene even if they’re never used, or is the cost simply the size of an empty gameobject?
Cheers,
SB
If a prefab is referenced somewhere, then yes it’s loaded into memory like any other object. Otherwise you wouldn’t be able to clone it with Instantiate.
If you really only want to load the prefab when you really need it, put it inside the Resources folder and use Resources.Load to get it the first time you need it.
Nice one, Jasper. You may have just made my day. 
SB.
Actually, another question regarding this:
If you do have prefabs in the array, as mentioned above, as they’re in memory (even if they’re not in the scene), what is the state of the textures in their materials? I know that textures are decompressed before they’re rendered, but as these objects aren’t actually used in the scene, would their content still be compressed?
I am not sure, but would assume that if more textures are needed they are loaded at the same time as everything else. They might not be pushed to the graphics card yet though.
However, textures are only decompressed in memory if the graphics card doesn’t support hardware decompression.