Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | steely | |
Old Version | Published before Godot 3 was released. |
My project contains many sprites that are loaded dynamically, rather than placed in a scene with the editor. These sprites must be able to dynamically change which texture they use. The obvious solution is a texture atlas, but I’m unclear how this should be done in Godot. The texture atlas documentation has very little information about the correct way to use it for my project.
How should I create the texture atlas? Is there a Godot tool that can handle this, or do I need to do it with a 3rd party tool/manually in Photoshop? I’ve seen the pseudo-atlas that Godot produces when the appropriate export option is set, but I don’t know if that would be useful in my case.
When and how should I load the texture atlas to make it available to dynamically created sprites? Should there be a texture object of some sort in the main scene, or a function call in the ready function of the main scene?
What’s the best way to select a sprite from the atlas? Are sub-textures indexed in some way, or do I need to retrieve them with a rect of texture coords?
Any other texture atlas issues I need to consider (neighbor pollution, etc.)?