HTML5 Build issue - disappearing game objects in production mode (SOLVED)

Hey there,

After bundling an html5 application in production mode, some of my game objects don’t show up. If bundle html5 straight up - it’s fine, if I bundle it as an application in dev mode, it runs and shows everything, but it’s really slow.

I’ve tried with and without rendercam. Anyone have any tips?

Check that you don’t have multiple components such as sprites on the same z value. Components with the same z value may be drawn in a different order between debug and release builds.

2 Likes

Have you checked the console output for any hints?

1 Like

I have checked the console and it doesn’t show anything.

I think the issue is with a factory - I have tried various z positions and it doesn’t seem to help - when I put in the component that the factory is generating, the component shows just fine. The components generated from the factory aren’t showing.

Can you please share the project as a zip file? (Exclude build and .internal folders)

Or, perhaps just this once, keep the build folder so that we can test that too?

1 Like

Have sent in a message, let me know if you got it :slight_smile:

Thank you again for being willing to help and improve Defold, it’s a really great platform.

2 Likes

Got it! And found the issue:

You have a function in level_maker.script which parses the string representation of a hash, for example [/collection0/foobar] to get the value within brackets: /collection0/foobar.

This will not work in release builds as we do not store the hash to string lookups in a release build. The hash will be just a number when converted to a string and your code breaks down as it fails to get a meaningful value back. You need to work around this and not rely on the reverse hash lookup.

PS I also noticed that a lot of your functions are global. It does not seem to be causing any problems at the moment but it can open up for nasty and hard to figure out bugs if two scripts or Lua modules define the same global function.

2 Likes

I would have never figured that out. Haha, thank you so much! I knew it was probably an error on my side, I just didn’t know what.

I will see what I can do about the global functions too - you are right, it can become an issue at some point.

Thank you again!

1 Like

Instead of trying to loop through every element and setting it up that way, I just made the element post a message back to it’s parent. This works much better. :slight_smile: Thank you for the last time! haha.

1 Like