I’ve been having huge issues with UI Toolkit.
What I’m trying to achieve is very simple; have a ‘menu button’/cog, when pressed, pulls up a menu in the center of the screen, and hiding that button at the same time. When you press ‘resume’ the menu disappears and the cog reappears. Simple, eh?
For a bit of history; I originally tried this with two separate Panel Renderers, scripts and styles - one for the cog, one for the menu, and hid and showed them using the SetScreenEnableState() method in the Unity examples. This didn’t work in the end as it caused a slew of errors within the internals of event system, throwing Null Pointers.
So I amalgamated the two Panel Reneders, scripts and style into one, and changed the visibility of the styles via setting style.display to either DisplayStyle.None or DisplayStyle.Flex.
Before I got to this I managed to get an absolute ton of;
WebGL - GL INVALID OPERATION: Insufficient buffer size
when ‘Build and Run’ -ing. The code would work perfectly in the editor but crash as soon as I moved the mouse over any element in the UI.
I stripped all of the failing UI elements out into a ‘cut down’ version of the project in order to bug fix the issue.
For some reason this seemed to clear up when I removed the text=“RESUME” from the Button element and moved it into a <ui:Label text=“RESUME” /> and removed any individual styles on the Button itself.
I have no idea why this happens. It still happens in the main version of the project, but now not in the stripped-down version. So this is still an issue for me going forward. Any help or advice on that would be gratefully received.
I still have another issue. Now I’ve gotten the project to not crash in a massive heap, I still have issues with hiding and showing elements where the entire screen gets mangled.
Upon hiding and showing turns into;
(Note: I have both cog and menu showing at the start for ease).
I’ve tried hiding using DisplayStyle.None / DisplayStyle.Flex and Visibility.Hidden / Visibility.Visible - and both! And always I get this issue.
Can any-one tell me what I’m doing wrong here? There has got to be something fundamental for the system to be causing ‘WebGL - GL INVALID OPERATION: Insufficient buffer size’ issues with only five or so elements on screen. There has got to be something fundamentally wrong with the styles being mangled so badly.
All these errors occur after ‘Build and Run’ and never in the editor itself.
I’ve reported the issue to Unity and filed a bug report, but having heard nothing from them for a week so I thought I’d turn to you guys for help.
Happy to provide any information you might require.
Project files are here; https://cols-general-stuff.s3.eu-west-2.amazonaws.com/WBTCutDown.rar (331 KB)