Reputation: 41
I have main menu scene only with canvas (no other objects and even no camera). By pressing certain buttons I open and close different menus and windows, but it causes lags and even freezes the game. There are no scripts that perform something in real time (like Update or coroutines), even no active animations or particle systems, so, i guess, the problem is UI itself. By following optimization advices, I disabled "raycast target" to most UI elements and divided canvas (each canvas' render mode set to Overlay, pixel perfect disabled), but it didn't help at all. For testing, I moved the window that causes freeze (it contains only 2 images and 12 buttons) to separate canvas, enabled all of canvases' objects, but disabled Canvas and Graphic Raycaster components - and game froze at the start. When disabled several menus objects (not the freeze-window), game stopped freezing but lags didn't disappear. The game is built for Android and all lags only happen there. What else can I do?
The issue is rendering, and profiler shows large amount of triangles and vertices (480 and 1k) in random moments, though i have no 3d objects on the scene.
Upvotes: 2
Views: 1510
Reputation: 41
Ok, i found a problem - it's font. Game spends 0.6 Gb of memory on texts and, i guess, even more at moment of crash. I've switched to default Arial font, but problem remains. Only setting font to None fixes crashes and lags, but that's not an option for me. Need to optimise these texts somehow.
Upvotes: 1