I’ve recently started learning more about collection proxies while exploring Defold. I found an older YouTube video explaining them, and I have to say it was excellent. I really hope the Defold team considers making more videos like that in the future.
I started by creating a simple loader that loads and unloads collections through collection proxies depending on what the game needs. For example, it initially loads the main menu collection, and when the player starts the game it unloads the main menu, then loads, initializes, and enables the gameplay collection. As far as I understand, this is a correct and intended use of collection proxies.
Now I’m considering using another collection proxy for my game’s pause menu, but I’m not sure whether that’s the right approach.
The pause menu itself is fairly simple: it only contains a GUI with a few buttons and options. My idea was to load, initialize, enable, and later unload the pause menu collection every time the player presses the pause button. This would all be handled through messages sent to the same main loader that already manages all my collection proxies.
What I’m struggling to understand is whether this is actually the recommended approach, or if it’s an unnecessary complication. Would it be perfectly fine to simply keep the pause GUI inside the gameplay collection and enable/disable it when needed instead?
In short, does repeatedly loading, initializing, enabling, and unloading the same collection have any noticeable performance cost? A player could technically pause and resume the game many times during a single play session, so I’m wondering whether that pattern should generally be avoided.
I also have another question: Is there a recommended way to display two collection proxies on screen at the same time, one on top of the other? I’m not referring to GUI components, since those seem to render on top of everything else without any issues.
If I understand correctly, each collection proxy is created as its own separate world. Because of that, if I keep two collection proxies enabled simultaneously, I wouldn’t be able to use the camera from one collection to render the game objects belonging to the other collection proxy. Is my understanding correct?
If so, is there a Defold-recommended pattern or best practice for handling situations where two collection proxies need to be visible at the same time? I think this version reads naturally for native English speakers while keeping the technical terminology that Defold developers commonly use (e.g. load/unload, initialize, enable, world, and collection proxy). Note that I used unload* onsistently instead of download, matching Defold terminology.