Collection Proxy URLs (SOLVED)

I’m having trouble accessing my level’s tilemap - the level is loaded through a collection proxy.

This is my game.collection:

And this is the collection for the particular level:

I’m trying to access the tilemap with the URL “game:/loader/level1/world#tilemap” but get a “not found” error. Is the URL wrong or something else? level1 loads successfully but then things go awry.

I find collection proxies quite confusing so may have arranged things wrong in the first place.

If you add a script in that game object, next to the tilemap, and add:

function init(self)
    print(msg.url())
end

you should get the url of the script, and from there deduce the url of the tilemap.

2 Likes

That’s really handy - thanks.

Each collection loaded through proxy gets a separate socket. If you have the id on the collection set to “world1”, the URL would be world1:/world#tilemap.

See http://www.defold.com/manuals/collection-proxy/#_naming_collections

4 Likes

Hello everybody,

I don’t mean to revive this thread but I just have to thank @sicher for this note.

I believe I faced the same problem why @benjames171 created this thread: the socket name of the URL.

You see, I am trying to implement an endless runner with tilemap segments as suggested by @vigridzki and @britzl in this other thread: Endless Runner - segment generation
And, when the segment registered with the controller the URL provided was something like [default:/segment1#collectionfactory] and I had no idea why was that… until now!

@sicher you the man! :thumbsup:

1 Like