- Home /
Dynamic content delivery on Unity iOS
Hi gang,
I need to display some UI textures that can be specified outside the Unity3D ios app via some tools I have written.
Downloading the files, works great, loading the files works great, drawing the images works great, but now that the workflow has been validated I need to do all of this in the background, so I just wanted to make sure I'm using the right approach.
(1)Take image URL (i.e. http://www.someserver.com/someimage.png) and hash it to a filename, and check if I've already downloaded and stored that file locally.
(2)If the file is found locally, add it to the list of files we're going to check the cache status of (in case the remote file has been updated since we last downloaded it.)
(3)If the file is not found locally, add it to the list of files that need downloading.
(4)When evaluating the cache, make an HTTP HEAD call against the image URL and check the last-modified data against the local file timestamp.
(5)If the local file is newer than the server's copy, add it to the list of files to be loaded locally.
(6)If the file is older than the server's copy, delete the local file and add the image URL to the list of files that need downloading.
(7)Pull down each file in the list from the designated web server. When the file arrives, create a local file by hashing the URL, then write the file locally and at it to the list of files to be loaded locally.
My presumption is that to background this and create Texture2D objects out of this, I need to spawn a coroutine that will do everything but the network calls and thread those (since I can't use WWW since it doesn't have HEAD) and have the coroutine while() loop on the network calls and yielding constantly... Then when all files should be local, loading them into Texture2D objects in the coroutine (since it will be in the correct thread.)
That sound crazy or pretty normal?
Cheers,
Your answer
![](https://koobas.hobune.stream/wayback/20220613141332im_/https://answers.unity.com/themes/thub/images/avi.jpg)