- Home /
WWW class texture lag and memory usage? HELP
Hello, my gameObjects import .obj meshes at runtime as well as texture images in a different script from the Application.dataPath (mainly the textures are .png format). However, when about 10 gameObjects load the texture files into their render.material the game starts to lag. Is there anyway to prevent this? it is definitely the textures causing the lag. They where made in paint and are only around 200kb-500kb in size. Also, I have task manager running and each time a object loads a texture the memory usage goes up by 15,000K. Please help, Thanks!
=======
EDIT: Anyone?
Answer by Paulius-Liekis · Aug 24, 2013 at 07:27 PM
Pack everything into AssetBundles (i.e. during build time). This way textures will preconverted into Unity format and compressed on load.
Alternative option:
Assuming that your game lags because of a lot of uncompressed textures, you could try loading them into compressed formats (as long as they are supported on your platform). Look into how to load texture into DX compression formats:
http://docs.unity3d.com/Documentation/ScriptReference/WWW.LoadImageIntoTexture.html
I would, however the textures need to be customizable for the users. But thank you for your suggestion. Is there any other way to get rid of the lag? WWW.LoadImageIntoTexture seems to make it A LOT worse for lag with only one object. >.< Is there even a way to make the textures use less memory?
Wait a $$anonymous$$ute... what is your problem exactly? It is lag/stalling during loading of textures or is it low framerate afterwards?
$$anonymous$$emory is being used up big time. Anyone? Thanks. :D