I’ve been trying to achieve the Modify atlas example in my own project for modding support with no luck so far. It seems like the example code gets the wrong UV coordinates, especially if the target image isn’t on the top-left of the atlas.
Downloading and running the example as-is works fine:
But adding random junk to the atlas breaks it:
If you look closely, you can see the bottom part of the green spaceship got overwritten.
Here’s a small demo project I made to test this out and make sure I wasn’t going crazy:
imagereplace.zip (4.0 KB)
The code tries to replace the orange-and-blue logo with the blue-only logo. It works when the orange-and-blue logo is the only one in the atlas, but it ends up replacing a totally different part of the atlas when another image is added.
I’m not sure whether this is a bug in the engine or just some bad example code.
EDIT: Forgot to mention I’m on 1.8.1, if it’s important.