Can you unload collection proxy fron GUI script?

Idea is

  • in main.collection to add proxy.collection
  • proxy.collection to contain only GUI with script attached to it

Is it possible to unload proxy.collection from GUI script, or I have to do it from another controller script?

As a result, I would like to call proxy.collection that contains GUI with animation tweening and after the animation ends to delete whole proxy.

You can’t unload a proxy from a script component within the proxy. The recommendation is to unload from some script that will not be unloaded (ie from a central controller script or similar).

2 Likes

Understood.

If in that script controller I have:

function init(self)
	
	msg.post("/proxy#proxyMsg1", "load")
	
end

function on_message(self, message_id, message, sender)

	if message_id == hash("proxy_loaded") then
		
		msg.post(sender, "init")
		msg.post(sender, "enable") 
	
      
end

I check it and it works.

But what if in init I want to load second proxy in advance and looks like this

function init(self)
	
	msg.post("/proxy#proxyMsg1", "load")
	msg.post("/proxy#proxyMsg2", "load")

end

in on_message function, how does if message_id == hash(“proxy_loaded”) knows for which proxy I am asking?

The sender argument tells you which proxy it is.

Oh yes, I understand that, I was thinking if I have 2 proxies to load from init(), does one argument “proxy_loaded” checks for all proxies from init() if they are loaded, and can I separate it, check if first proxy1 is loaded, and then later (when I need it) to check if second proxy2 is loaded.