Problem after loading a collection from proxy (SOLVED)

Alright so I have tried my best researching in the manuals and API references. I could completely over looking what it is I’m messing up on.

Here is my hierarchy:

main.collection
– level_proxies (GO)
– main_menu (GUI)

level1.collection
– camera (GO)
– level1_world (GO) includes tilemap
– player (GO)
– spider (GO)
– spider1 (GO)

From my gui_script when the level1 button is pressed it sends this code, and waits for response

main_menu.gui_script

function on_message(self, message_id, message, sender)
    
	if message_id == hash("proxy_loaded") then
		msg.post(".", "disable")
		msg.post(".", "unload")
		msg.post(sender, "init")
		msg.post(sender, "enable")
	end
end

function on_input(self, action_id, action)
        msg.post(".", "release_input_focus")
        msg.post("main:/level_proxies#level" .. i .. "proxy", "load")
end

player.script

function init(self)
        -- Some custom variables here
	msg.post(".", "acquire_input_focus")
end

Everything loads perfectly, level loads up and all scripts are running. However no input I do is sent to the player script or the gui_script.

Before I started working on the gui and collection proxy everything worked, input and all. Somewhere in the script input is lost and i cant seem to get it back.

My question is, am I sending the right messages to the proxy to do a proper transition or am I missing something somewhere?

1 Like

plz, check

or

How do I receive input to a game object inside a collection loaded via a collection proxy?
http://www.defold.com/faq/

or

3 Likes

Ahhhh, thank you very much! I was looking in the wrong place.

Just to be super clear here for anyone stumbling upon this problem in the future: The problem is that you did msg.post(".", "release_input_focus") in the main_menu.gui_script when you loaded the level collection. In order to get on_input() calls to your loaded collection proxies you need to also have acquired input focus in the collection containing the loaded collection.

The links provided by @AGulev explains this in more detail.

3 Likes