My game loads a collection to show the ending screen when the score is 2, however this error keeps popping up. I have had no issues with loading or unloading any other collections, even though they are all done in the exact same way as this collection.
ERROR:GAMEOBJECT: The collection 'ending_something' 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: /main/collections/ending_something.collectionc: OUT_OF_RESOURCES
ERROR:GAMESYS: The collection /main/collections/ending_something.collectionc could not be loaded.
ERROR:GAMESYS: The collection /main/collections/ending_something.collectionc could not be unloaded since it was never loaded. Message 'unload' sent from main:/controller#main to main:/controller#ending_proxy.
I have checked all of the IDs and none have the same name as âending_somethingâ
I canât understand why this is going wrong, any help would be appreciated!
Is it possible to send the message to load a collection to a loader script from multiple script, based on events that happen? not simultaneously obviously, but depending on conditions one script could send the message or a different script could send the message?
function update(self)
-- when two correct answers the game is complete - will be increased to five
if self.correctAnswers == 2 then
msg.post("main:/controller", "show ending screen")
end
end
this is the code from the loader script that should load the collection
elseif message_id == hash("show ending screen") then
-- ending screen
msg.post(self.current_collection, "unload")
msg.post("#ending_proxy", "load")
self.current_collection = "#ending_proxy"
end
can anyone see any reason why this wouldnât work?
Youâre firing off the âshow ending screenâ message in the update() function, with no way for it to stop after the first message. You need to ensure that message is only sent once, otherwise youâll see some unintended behaviour.
Some examples, not knowing your projectâs structure:
function update(self)
-- when two correct answers the game is complete - will be increased to five
if self.correctAnswers == 2 then
msg.post("main:/controller", "show ending screen")
self.correctAnswers = 0
end
end
Or:
function update(self)
-- when two correct answers the game is complete - will be increased to five
if self.correctAnswers == 2 and not self.endingScreenTriggered then
msg.post("main:/controller", "show ending screen")
self.endingScreenTriggered = true
end
end