So I’m trying to load a proxy ("debug"). However, I get
ERROR:GAMEOBJECT: The collection 'debug' could not be created since there is already a socket with the same name.
ERROR:GAMEOBJECT: AcquireResources NewCollection RESULT_OUT_OF_RESOURCES
WARNING:RESOURCE: Unable to create resource: /areas/test_place/debug.collectionc: OUT_OF_RESOURCES
ERROR:GAMESYS: The collection /areas/test_place/debug.collectionc could not be loaded.
I don’t know what’s wrong, I’ve checked every collection I have and none of them have the same name.
Someone look at this, please?
DEBUG:SCRIPT: debug2
WARNING:GAMEOBJECT: Instance is initialized twice, this may lead to undefined behaviour.
Assertion failed: !component->m_AddedToUpdate, file ..\src\gamesys\components\comp_collision_object.cpp, line 832
D:
I guess I’ll have to look for where it init twice…
Also, where is
..\src\gamesys\components\comp_collision_object.cpp, line 832
anyway?
I think it’d be helpful in trying to fix this. : /
Alright, I’ve been looking for a while and I can’t seem to find where the problem is (maybe because I’m not looking in the right places?)
Is there anyone who can help me look for where the double-init might be? (I can send you my project if you give me your email) Or maybe give me some advice on where to look properly?
The problem was in /overworld/overworlds.script. I’m still not sure what exactly caused the error, but just cleaning up the script seems to have fixed it.
Original
function init(self)
local rendercam = require "rendercam.rendercam"
end
local curarea = "notexist"
local newcurarea = ""
function on_message(self, message_id, message, sender)
if message_id == hash("load_area") then
msg.post("#"..curarea, "disable")
msg.post("#"..curarea, "unload")
msg.post("#"..message.new_area, "load")
msg.post("#"..message.new_area, "enable")
curarea = message.new_area
area = message.new_area
print(curarea)
end
if message_id == hash("load_area2") then
msg.post("#"..curarea, "disable")
msg.post("#"..curarea, "unload")
msg.post("#"..message.new_area, "load")
msg.post("#"..message.new_area, "init")
curarea = message.new_area
area = message.new_area
print(curarea)
end
end
Fixed
local rendercam = require "rendercam.rendercam"
-- This sets curarea to nil
local curarea
local newcurarea = ""
function on_message(self, message_id, message, sender)
if message_id == hash("load_area") or message_id == hash("load_area2") then
-- 'if curarea then' is the same as 'if curarea ~= nil then'
if curarea then
msg.post("#"..curarea, "disable")
msg.post("#"..curarea, "final")
msg.post("#"..curarea, "unload")
end
msg.post("#"..message.new_area, "load")
print("Loading area '" .. message.new_area .. "'")
curarea = message.new_area
elseif message_id == hash("proxy_loaded") then
msg.post(sender, "enable")
end
end
P.S. You should take the time to go through your project and do some cleanup while it’s still relatively small. It really does make everything so much easier down the line.