Resize on different screen size

Every time the window resizes, you want to rescale the texture to the dimensions of the canvas. This ensures that it will always have the same resolution as the scene

// adt is your AdvancedDynamicTexture, engine is your Babylon.js engine
window.addEventListener("resize", () => {
adt.scaleTo(engine.getRenderWidth(), engine.getRenderHeight());
});
2 Likes