Skip to content

Conversation

@BloodLantern
Copy link
Contributor

@BloodLantern BloodLantern commented Dec 31, 2025

Following my issue, here is the code change to allow using nested layers for rendering, fixing #892.

@prime31
Copy link
Owner

prime31 commented Jan 2, 2026

Looks good, the only issue is that it is a big breaking change for all existing projects. I posted the PR in the discord to start a discussion. One quick and easy alternative would be to just have a new component with the public ITmxLayer[] LayersToRender to avoid breaking any existing code.

@BloodLantern BloodLantern force-pushed the allow-rendering-nested-tiled-layers branch from b6b3c61 to cef9f7b Compare January 2, 2026 10:09
@BloodLantern
Copy link
Contributor Author

BloodLantern commented Jan 2, 2026

I thought about another solution that could still be implemented quite easily and that wouldn't break existing projects. Instead of searching recursively like I did, we could instead ask for a path to the layer, with slashes to indicate going in a group layer.
Reusing the example given in my issue, to access the Terrain layer nested in the Level group layer, one would use "Level/Terrain".
I think that would probably be the best solution, and it would be more intuitive this way as well.

Adding this just in case, the force push was to rebase the master branch on top of this one instead of merging to avoid an unnecessary commit

@BloodLantern
Copy link
Contributor Author

I just realized that you can put slashes in a tiled layer name, so actually I don't know if it would work that well

@optimo
Copy link
Contributor

optimo commented Jan 2, 2026

thanks for working on this. personally its not an issue for me now(it was once, only briefly when I started), but I can see the utility of having tile layers in groups instead of flattening that out.

just giving my two cents. I think the solution where we can resolve the path from the name - using a slash or maybe a double slash (or maybe backslash(es)) might be the best way to go. it does seem intuitive!

suppose if no other option, an additional method could be added, like SetLayersToRenderRecursive, using the code you already supplied. and/or an overlloaded constructor.

@BloodLantern
Copy link
Contributor Author

I implemented the path-like syntax to get layers with slashes or any given separator.
The way I implemented the function makes it so that it shouldn't break any existing project (except for the API change for LayersToRender) because it first checks, just like it was doing before, for a layer with exact name matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants