Unloading collection proxy

Hi
Instead of when I unload a collection proxy having to tell the controller script what proxy exactly to unload, is there a way I can write the code so that it unload which ever proxy is loaded and loads like a level select area?

No, you need to explicitly select which collection proxy to unload. I find it a useful practice to have some kind of controller/manager/main script that keeps track of and does the loading and unloading of collections.

Yes, thats what I have, but my issue is I have a back button on the gui screen for all three levels. I didnt want to make a separate gui for each level to have a back button. Because when you click it, it unloads the current level and loads the level select. So I was just seeing if there was a way to unload whatever collection proxy is already loaded without having to specify

Ok, I see. Without knowing the details of your app my guess would be that you could either: 1. Send the URL to the currently loaded level proxy to the GUI or 2) Let the back button post a message back to your controller script and let the controller script unload the correct level proxy.

I was doing the second option, but because of my blank gui issue its bothersome to set up different buttons for each levels. If not for that, I would make a separate back button for each level. So basically the UI “Score, live counter, back button” is the same shared gui scene. So making the back button unload only level 1, would keep level 2 loaded if the user doesn’t load level 1. This works however lol

`function on_input(self, action_id, action)
 	if action.pressed and gui.pick_node(gui.get_node("back"), action.x, action.y) then
 		msg.post("controller:/controller", "back")
 		msg.post("controller:/controller", "back2")
 	end
end

 `

The loader gets a a message to unload to unload level1 and level2 proxy when the back button is pressed. even though both arent loaded, there’s just an error telling you one or the other wasn’t loaded. But it works for my situation. Btw what do you mean Send the URL to the currently loaded level proxy?

You can ignore that comment. I see now that you have a proper controller that takes care of loading and unloading. I thought that perhaps you unloaded the collection from the gui_script attached to the gui with the back button.

1 Like