Hi again, and thank you for your answers!! T_load.LoadImageIntoTexture(t_dynamic_tx) String targetFile = "file://" + Application.dataPath + "/Resources/Textures/Icons/Chairs_64圆4.png" ĭebug.Log("Beginning load at time: " + Time.time) Įlse if (t_load.isDone & t_dynamic_tx = null)ĭebug.Log("File has finished being loaded at " + Time.time) ĭebug.Log("Preparing to load PNG into Texture") GUI.Label(new Rect(164, 200, 64, 64), t_static_tx) ĭebug.Log("Application data path: " + Application.dataPath) In my script I manually put in a prefab for t_static_tx and loaded t_static_tx from a file (for comparison): public Texture2D t_static_tx = null Here's a quick demo-code I put together to test out and make sure the functionality worked. The method that you used (using texture property of the enjoy the awesome unity in any type of application.īeen beating my head against a wall all day and went through a lot of different posts, this one helped the most (thanks Ashkan for the direction), worked for me. If texture format before calling LoadImage is DXT1 or DXT5, then the loaded image will be DXT-compressed (into DXT1 for JPG images and DXT5 for PNG images). JPG files are loaded into RGB24 format, PNG files are loaded into ARGB32 format. This function replaces texture contents with downloaded image data, so texture size and format might change. I found this info in documentation of LoadImageIntoTexture method. if you don't need a texture, don't forget to Destroy it. The best approach is to compress your png/jpeg images then create a texture2D in DXT11 or DXT5 format then load the newly donwloaded texture into it with in this way the texture will be compressed to DXT1 or 5 based on it's format. using to create textures at runtime with the format that you want, you should load the texture with www("file::path") and then create another texture with the format that you want to do some getpixels/setpixels so it will take a huge time for 500 big textures. When you import images in unity weather it's in resources folder or any other folder, the image will be compressed to a format (dxt most of the times) and then stored so they take less memory. Which is the cause of that difference? Do you have some ideas to reduce the used memory using WWW ? There is another, and best, way to load images? Using Resources.Load() -> 1 MB used textures and 10.3-11.4 MB VRAM usage. Loading the 3 same textures the 2 methods work: Note: Each texture loaded is for a different newPlane (a prefab of a plane). I also have tried using WWW but using it the images use a lot of memory, my code using this method is: string imagePath = "file://C:/BLA_BLA/Image_Series/" + imageName + ".png" In total there are about 500 images of 1400x500 aprox.Īt first I tried using Resources.Load() and it worked very find, but in the release I can't use it because the images wouldn't be in the folder Resources. I am making a project which has to load series of images of a system folder (C:/BLA_BLA/Image_Series/).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |