I use Google Chrome on my Android 13. I open some GUI examples (BABYLON.GUI.AdvancedDynamicTexture) and realized that when I go to some another app and return back to Google Chrome all GUI buttons dissapear. Meshes still stay there. I can even click that GUI button and it works but the texture has gone but if you click the emptiness you can click it
The same behaviour I met when I saw all examples that draw a text using BABYLON.DynamicTexture.
It that known issue? How to deal with it? Maybe there some methods to reload those textures?
Yeah, I just go to my home screen and after 5-7 seconds of waiting, I go back to Chrome. It’s not refreshing, no unloading or something like this, but there is no the dynamic texture as well.
Manually redrawing really saves the life. Almost. But sometimes dynamic textures stay black after browser wake up. And in this case we can set timeout value to, let’s say: 3000. Yeah, too much. But it works everytime. So, therefore we can call manually redrawing two times or more: setTimeout: 0ms and 3000ms to be sure it redraws successfully.
Strange, but I haven’t seen such behaviour in Firefox. It never goes black after browser wakes up. But instead of it, it refreshes the whole page manually
Could you please tell me, is there some way to redraw GUI. AdvancedDynamicTexture() in similar way? Anyway I can dispose all the GUI and create it again after browser wakes up but maybe there is some redrawing options already exist there
One more adding: when the GUI dynamictexture has gone after bromser wakes up, then I open Inspector in Playground, and it restores GUI textures. I think it’s because of resized canvas. Looks it has some redraw functions inside it but how to call it manually I don’t know.
It works for GUI AdvancedDynamicTextures (CreateFullscreenUI) only and not for DynamicTextures, and even not for AdvancedDynamicTexture (CreateForMesh). It’s all about canvas resize processing I suppose.
So I need to call something like on_resize() event on GUI.AdvancedDynamicTexture.
That worked for AdvancedDynamicTexture (CreateFullscreenUI). Which is awesome!
And it didn’t work for a dynamic texture that drawn on _text_ground_mesh (CreateGround). In this case I can redraw a text again
It’s a pity that DynamicTexture doesn’t have makeAsDirty() method. Or does it named with some another name maybe?
No, there’s no method like markAsDirty() in DynamicTexture. In fact, a markAsDirty method will have to redraw the text, so it’s the same thing than calling drawText again.