GUI.AdvancedDynamicTexture.CreateFullscreenUI Clipping

I’m experiencing some strange behaviour with the GUI.AdvancedDynamicTexture.CreateFullscreenUI when the user resizes the window. The text is much lower than the meshes it’s linked to:


I was able to somewhat fix this by dynamically setting the height of the GUIs canvas, like so:

uiTexture.getContext().canvas.height = canvas.height;

But then I get this: (after a certain height the text starts to clip)

I’ve combed the documentation for the GUI.AdvancedDynamicTexture and there doesn’t seem to be a way to tell it to recalculate it’s size.

Note: I think the reason a lot of this is happening is that the height of my canvas is “flex” using CSS flexbox. Not shown in the code example is a hack I have to reset the canvas to the full height of it’s flexed container:

canvas.height = 1;
const rect = canvas.parentNode.getBoundingClientRect();
canvas.height = rect.height;
uiTexture.getContext().canvas.height = canvas.height;


can you try texture.resize(…) to see if that suit your needs?

Else can you provide a simple repro in the playground to see what we can do :slight_smile: ?

Hi @Deltakosh.

I get the following:
uiTexture.resize is not a function

I don’t think I can create a repro in the playground since I have no control over the DOM nodes above the canvas, which I think is the root of the issue (CSS Flexbox)

The uiTexture variable is initialized as follows:
uiTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI('UI', true, scene);

Sorry my bad, I wanted to say:

uiTexture.scaleTo(x, y)
1 Like

@Deltakosh, thank you! That worked wonderfully.