Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix assetName for textures when the parent ldtk is in a nested folder #25

Merged
merged 1 commit into from
Jul 15, 2023

Conversation

jaguire
Copy link
Contributor

@jaguire jaguire commented Jul 15, 2023

The path in the ldtk file is relative to itself, but the asset name is a path relative to the content folder. Since larger projects will have a folder structure under the content folder. The content.Load<T> needs to respect that structure. This gets the folder(s) in between content and the ldtk file and prepends it to the filename. It just passes the file through if in the root.

Content
  ├─ LDtkFiles
  │    ├─Atlas
  │    │    └─ Cavernas_by_Adam_Saltsman.png
  │    └─ AutoLayers_1_basic.ldtk
  ├─ Images
  │    └─ ...
  └─ Fonts
       └─ ...

This fixes: content.Load<Texture2D>("Atlas/Cavernas_by_Adam_Saltsman")
To: content.Load<Texture2D>("LDtkFiles/Atlas/Cavernas_by_Adam_Saltsman")

@IrishBruse
Copy link
Owner

Thanks for the PR in the meantime you can use your own renderer to fix this just copy the LDtkRenderer into your project and use that one instead when I get a chance ill make a release.

@IrishBruse IrishBruse merged commit 80aa132 into IrishBruse:main Jul 15, 2023
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.

2 participants