This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I've been trying to export my 2d-game running GLES2 to HTML5 and getting it to run properly. Whenever I do this, some of my textures appear to be missing in the exported version. This includes all my animated textures and textures that are applied to objects in code only and that are not visible in the editor.

Is there a workaround to this? I've looked around for answers on the web, but I'm not getting anywhere.

Godot version 3.4.3
in Engine by (12 points)

Are your textures using non-power-of-two sizes? This can cause various problems if they are set to repeat or are using mipmaps. The best way to fix this is to resize your textures to the nearest greater power of 2.

The WebGL 1.0 specification (which is similar to GLES2) does not mandate support for non-power-of-two textures.

Also, can you reproduce this when exporting the project to a native PC platform (Windows/macOS/Linux)?

Thank you for your reply.

The first four png-files that aren't exporting properly are all spritesheets containing 16 rows and columns. The total sprite dimensions are 2560x2560 which sounds like a power of 2 to me.

The other 15 png-files that aren't exporting have all sorts of odd dimensions such as 58x53, 64x53, 45x51, 16x12 and 13x10 for example.

My sprites are not set to repeat nor using mipmaps.

Exporting to PC or macOS works just fine. I have had no issues whatsoever.

Edit: added an answer instead.

2 Answers

0 votes

Bump - I'm having the same issue. OP, did you ever find a solution?

by (18 points)

Unfortunately I never found a solution. It made me so frustrated I completely stopped working on my game instead. I might get back to it once Godot 4 is out.

0 votes

Ok: a simple solution that worked for me:

1) When dynamically importing textures into sprites, instead of load(), use ResourceLoader.load(). The ResourceLoader is capable of finding the referenced files even after export.
2) If dynamically importing scripts, make sure you set the script form to plain text when exporting.

I did those two things and solved my problems. I hope they get you your game project back!

by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.