Hi,
I made a program where the user can load pictures from disc with windows.forms. Problem is, when you load too many images, the whole system crashes because there is no more room in the memory. A few hundred images are several GB of main memory. I loaded a folder with 164 images (276MB) and in game they need 1.3GB of RAM. There are no complex GameObjects, just planes.
Is there a way to load the GameObjects with the loaded images only when they are in sight of the camera? For they are all built at runtime they are not anywhere on disc.
Thanks in advance and sorry for bad english. ![]()
-
you can query the operating system for the size of a file before you load it. Don’t load it if you don’t have the memory.
-
there’s no built in way to load images when the camera is only near where they are, you’ll have to implement this yourself. This can be done… you keep track of what images need to show and load them as necessary.
-
note, loading them as necessary can still eat up memory, so you may want to unload images when they’re no longer seen.
-
maybe do all this only if the image count/size is greater than some memory cap.
Thanks for the hints. ![]()