How can I download a file (.jpg) and store it?


I’ve been looking documentation and it’s not clear to me. I’ve been trying to use “fileUtil.replacefile” with no results.

I need to download a file and store it locally so it will work without internet connection. So, the downloaded file should replace an asset.

I’ve been trying it for a week and I ran out of ideas, plase help! :frowning:

Thank you so much in advance.

You can not replace an asset by just downloading an image from the internet (well unless we’re taking about Editor space, but I doubt that we are). You can download image using WWW class, and then store it anywhere on disk using something like File.WriteAllBytes(www.bytes). Later you can load the same image form local disk using same WWW class. Use WWW.texture to access the downloaded image (i.e. for putting it on a material and so on)