Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Do images (and/or other assets) unload automatically?

Asked by 6 years ago

I've been using a ton of images in my scripts lately, and it made me wonder if it was possible that a massive amount of downloaded assets would lag and clog memory.

I have several questions about assets. When are they downloaded? I would assume the moment an ImageLabel instance (or similar) sets the image property. If so, when is the downloaded image removed from memory? When the instance calls destroy(), when the instance changes its image property, or would I have to unload it manually?

On the topic of unloading images, how do I load images early? As in, how would I make the client download the important images during the loading screen, so that when I create an ImageLabel instance the image is shown instantly, without the small download delay?

0
What are you making that contains a bunch of images? GingeyLol 338 — 6y

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
6 years ago

To load images early use ContentProvider/PreloadAsync. Or the deprecated ContentProvider/Preload. (Difference is Async yields, and takes Instances not links.)

This is what most loading screens use.

As for image garbage collection I haven't seen any info on it, but since you can't GC specifics anyway you should simply trust the client. In my experience all images seem to stick around forever once loaded.

Ad

Answer this question