Problem with missing textures

Thats the screen of the game actually… it is a BlackJack game.

But after some playtrough pressing restart button, the meshes gone missing. As the picture bellow.

You can test the game at

And the code on github, so you can check what is wrong:

I`ll like to solve this problem, i re-write my code from bottom at least 4 times already and this always happens. After 64 restarts, this material of the meshes gone out.

Anybody knows how to solve it?

That’s because each time you create a highlight layer it’s raising the stencil reference value it uses for rendering. When reaching 255 it can’t go higher and make the rendering fail.

You should reset the value to its defaut value when clearing your scene. In GameCore just do:

public removeAll () {
    HighlightLayer.GlowingMeshStencilReference = 2;

Note that it happens because you create new highlight layers each time a new game is created: the new layers are created in Blackjack.createBoxCard.

If you create those layers a single time and reuse them, the problem won’t occur. Also, if you don’t change this, you should call dispose on those layers when recreating a game else the ressources won’t be reclaimed.


Thats solved the problem, thank you very much @Evgeni_Popov