Collection Proxy Camera is registered when collection is loaded
I’m using a small manager collection which has 2 collection proxies:
-
Splash
-
Menu
The collections both have unique cameras.
I’m doing an async load of the splash collection first and everything works fine.
The splash waits a couple seconds and then async loads the menu collection.
When the async_load is called on the menu collection, the menu collection camera is registered
and can be even found by camera.get_cameras().
As the menu camera is loaded after the splash camera, the default renderer prioritizes it and shows the menu camera instead of the splash camera.
I haven’t even posted a message to init or enable the menu proxy, so
Why is de menu camera being registered and used?
local menu_proxy_url = “game_manager:/manager#menu_proxy”
local splash_proxy_url = “game_manager:/manager#splash_proxy”
local SPLASH_DURATION = 5
function init(self)
msg.post(splash_proxy_url, hash(“load”))
end
function on_message(self, message_id, message, sender)
if message_id == hash(“proxy_loaded”) then
-- ========= MENU =========
if sender.fragment == hash(“menu_proxy”) then
if not self.has_loaded_splash then
local total_menu_loading_time = os.time() - self.menu_loading_time_start
local delay = math.max(SPLASH_DURATION - total_menu_loading_time, 0)
timer.delay(delay, false, function()
self.has_loaded_splash = true
msg.post(splash_proxy_url, “unload”)
-- msg.post(menu_proxy_url, “init”)
-- msg.post(menu_proxy_url, “enable”)
end)
end
end
-- ========= SPLASH =========
if sender.fragment == hash("splash_proxy") then
self.menu_loading_time_start = os.time()
msg.post(menu_proxy_url, hash("async_load")) -- this loads the menu camera instead of the splash camera
-- Start Splash Collection
msg.post(splash_proxy_url, hash("init"))
msg.post(splash_proxy_url, hash("enable"))
timer.delay(2, false, function()
print("Splash established. Now loading Menu...")
msg.post(menu_proxy_url, hash("load"))
end)
end
end
end