Problem of the prefab of the memory

I have a doubt:
If I load 30 prefabs which are coming from one prefab file to my scene, how much memory will be used(30 or 1)?

I mean the mesh and the texture of the prefab .

1 Answer

1

30 shallow copies.

But, as an example, a Meshrenderer links to a material and a mesh, so no matter how many meshrenderers you create, you’ll only have one copy of the mesh in memory and they’ll all share it. It’s often possible to build your own components to follow this model if memory is a concern.

ok thank you. If I use this code :"Object.Instantiate(Resources.Load(path));" and run 30 times.From the second to the thirty, does it read every time or only one time through IO?

Should just be once, might be a lot; I've never tested it. Regardless, it's always better to just store the result of .Load if you're going to be reusing it.

I'm worried too much about it.Thanks for your help.