Hello guys…
This is the life cicle of my game “menu” > “selectPlayer” > “world1” > “menu”
but when I am try to access the “menu” from “world1” i receive this message:
ERROR:GAMESYS: The collection /loader/menu.collectionc could not be loaded since it was already. Message 'load' sent from loader:/go#script to loader:/go#menu.
Here is my loader collection:
function init(self)
self.lastSender = nil
msg.post(".", "acquire_input_focus")
msg.post("#", "menu")
end
function final(self)
msg.post(".", "release_input_focus")
end
function update(self, dt)
end
function on_message(self, message_id, message, sender)
if message_id == hash("menu") then
self.lastSender = sender
msg.post("#menu", "load")
end
if message_id == hash("selectPlayer") then
self.lastSender = sender
msg.post("#selectPlayer", "load")
end
if message_id == hash("world1") then
self.lastSender = sender
msg.post("#world1", "load")
end
if message_id == hash("gameover") then
msg.post("#winLose", "load")
self.lastSender = sender
--pprint("novo sender" .. sender)
-- print("recebeu loader")
end
if message_id == hash("proxy_loaded") then
-- New world is loaded. Init and enable it.
msg.post(sender, "init")
msg.post(sender, "enable")
if self.lastSender ~= nil then
--pprint("unloadding" .. sender)
local proxy = msg.url(self.lastSender)
msg.post(proxy, "disable")
msg.post(proxy, "final")
msg.post(proxy, "unload")
end
end
end
function on_input(self, action_id, action)
-- Add input-handling code here
-- Remove this function if not needed
end
function on_reload(self)
-- Add reload-handling code here
-- Remove this function if not needed
end
What it is wrong here?
If I called msg.post(proxy, “unload”) why am I receiving this message?