#repaint lag solutions

1 messages · Page 1 of 1 (latest)

pale yarrow
#

in my custom game editor (built on unity), i do a lot of repainting for my tile based game and depending on the size of the map i am working on, there can be a lot of lag. are there any general principles or techniques I can apply to improve performance? should I be repainting so much? its the only way i can think of to get changes to show right away. happy to provide any additional info that would help with advice

fervent cape
#

Repainting what exactly? What are you rendering it with? GUI?

pale yarrow
#

in the scene view mostly. i repaint both the 3d viewport and the main editor window, but the scene view is where it hurts. the tile map itself is drawn with meshes—one batched mesh per 64×64 region from a MapPreview component (overlay/underlay tiles merged per region). then i’m using Handles for stuff like brush preview, height brush highlight, clipping preview, bridge simulation overlay, tile info, etc., and the window uses imGUI plus a bit of UIToolkit for overlays.
i repaint a lot because i want paint strokes and mesh updates to show immediately, and when shaders are on or i’m in spawn mode i’m basically repainting every frame for animated previews. i already try to only repaint the active scene view during strokes instead of all of them, but there’s still plenty of repaint calls. and on bigger maps it gets worse—one stroke can touch up to 9 regions (center plus neighbors for underlay blending), and each one does a full 64×64 mesh rebuild. so yeah, a mix of mesh work and repaint frequency.

fervent cape
#

That's a lot of different types of rendering going on, you should profile/debug it to see what is the main cause

#

Handles is generally pretty slow from my experience, especially the anti aliased methods

#

I'd just stress test different parts of the rendering and see what is the heaviest

#

(A screenshot could be useful showing what kind of things you are rendering)

#

Sharing some of the code is probably helpful too

#

!code