OK i actually found some kind of solution, i dont know if this is the best solution but is better then the trick i used to solve the problem before.
There it goes:
Create a GO in main.collection … name it : nextlevel.
Add 3 components on it: 2 collection proxy ( one for each level), 1 script
edit the script with what you think is necessary, like imput for change levels … and this:
function on_message(self, message_id, message, sender)
if message_id == hash("proxy_loaded") then
-- New world is loaded. Init and enable it.
msg.post(sender, "init")
msg.post(sender, "enable")
end
end
- observation you will need to learn disable the previous level … and add here to.
inside the “input” or “collider” or whatever you use to activate the level change you edit this.
msg.post("main:/nextlevel#level2", "load")
ok the explanation for this is: the first part “main:” refers to a collection …you can do like this: msg.post("/nextlevel#level2", "load")
to use the absolute path if is inside of the same collection or:
msg.post("nextlevel#level2", "load")
to use the relative path, this mean only for the GO its calling the function.
So since all the game is wrapped inside the main collection, make sense you put the “nextlevel” GO on it and make it call other "level.collection"s from it … but if in you game like in mine some part inside the “level” that will call the “nextlevel”, then you will need to refer to something outside the collection where you are so you need edit like this:
msg.post("main:/nextlevel#level2", "load")
I dont know if this is the best option, but it works for me … and i dont know if is properly explained, but i hope it helps someone out there.
The only remaining thing if how to keep data from one level to another … i still didnt get there, but will be my next step, until only had the idea of keep in “main.collection” a “datatransfer” GO and update it before switch levels, destroy the “player” GO … and on next level when it is loaded load a “player” GO and use the “datatransfer” GO to download the data on it.
anyone in the mood to help will be very welcome.