Download Image Node

At the moment i am using the ‘Download Image’ node and then saving the 2DDynamic reference it gives you, within a struct. I am using a save game file with only an array of these structs in to save these.

It works the first time i add the images in but upon reloading the game, the image reference all vanish from my structs but the other info remains.

Is this something to do with the node or do i have to convert the reference somehow?

I have tried also keeping the url reference in the same struct and loading them through a foreach loop. It comes back saying download success but no images appear

any suggestions

Thanks

1 Like

Quick update, i created my own loop which waits untill the image has downloaded before proceeding and this has worked

however would still like to know if its possible to actually save the image and not just, what seems to be, store it in memory temporarily.

Would you be able to share how you used a loop to wait until the image finishes downloading?

1 Like

Hi lex, still wondering how to create the loop? I can post my solution.

1 Like

Can you post it? I’d be interested in fixing that too, thanks!

1 Like

Hey Loeizd here’s my solution and it works fine.
At the Setup Images Event, I get the imgs URLs and store in an Array. Then I create one image object for each url and store the objects in an Array also.
After that I call DownloadSetImages (the call for this event is not in the image). This event calls DownloadSetOneImage.

The DownloadSetOneImage is where the loop happens. I download the image using the URL from the array and then set that to the Image Object. Then I check the current index to see if is there any more image to download. If its true, call DowloadSetImages again. Then it goes and downloads the next image.
This continues until the final URL is reached. Then the brach goes false and the loop ends. Then I add the first image of the Array to the Screen.

That’s it. After the player leaves the are I call DeleteImages event. That clears the array and it frees the memory.
I’m not sure where the images are stored, but it’s a good practice to free memory.

Feel free to ask anything. This a misterious topic. I struggled to find any information on that.

1 Like

Thank you!

Maybe a better way to solve this problem is to cache the images to the local disk.

I have released a plugin named “ImageCache” to solve problems like the above.
Marketplace Url:

1 Like