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

Using resource.set_texture changes texture of ALL sprites using same atlas #6468

Closed
BitsAtPlayDev opened this issue Mar 14, 2022 · 1 comment
Labels
bug Something is not working as expected

Comments

@BitsAtPlayDev
Copy link

**Describe the bug **
Using resource.set_texture on any sprite, changes texture on ALL sprites using same atlas

**To Reproduce **

  1. Create an empty project
  2. Create two sprites using the same atlas (The sprites can refer to same image within atlas, or different images)
  3. Use example code from 'resource.set_texture()" entry in API docs to update texture of one of the sprites
  4. Both sprites have been updated to use new texture

**Expected behavior **
Only sprite referred to in call to 'set_texture' should have it's texture updated.

**Defold version: **

  • Version 1.3.0

**Platforms : **

  • Platforms: Android, MacOS
  • OS: Android 8.0.0; MacOS Montery 12.1
  • Device: LG G6

**Minimal repro case project: **
There are two attachments: One using custom sprite materials & custom render-script, one using the default sprite materials & default render-script

SetTextureProblem_customMaterials.zip
SetTextureProblem_defaultMaterials.zip

@BitsAtPlayDev BitsAtPlayDev added the bug Something is not working as expected label Mar 14, 2022
@BitsAtPlayDev BitsAtPlayDev changed the title Using resource.set_texture on any sprite, changes texture on ALL sprites Using resource.set_texture changes texture of ALL sprites using same atlas Mar 14, 2022
@JCash
Copy link
Contributor

JCash commented Mar 15, 2022

That is true, if you replace the texture, you replace the entire texture.
We currently don't have support to update a region of the texture.

As such, this is not a bug.
But perhaps you wish to file a feature request for support of getting the region/uv-coords of a sprite image inside an atlas. With that info, we can implement support for setting a sub-part of the a texture.

@JCash JCash closed this as completed Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants