Custom render tilemap selection gizmo

When using a custom brush, I’m looking to also handle the preview border of the brush myself. I can’t seem to find an override or even an event that correlates to the mouseOver event on a grid in the editor.

Specifically, when I use the “Paint with active brush (B)” option from the Tile Palette window, I can’t figure out how to modify the render border of the gizmo in the scene view. This is what I see:

8874174--1211802--upload_2023-3-13_19-16-44.png

I’m looking to handle the borders of the grid element I’m hovering over myself, so that I can indicate the brush width of a custom brush I’ve created. I see a selection area when using “Select an area of the grid (S)” option from the Tile Palette window:

8874174--1211808--upload_2023-3-13_19-19-18.png

This multi-tile selection is close to what I’m looking for, but I’d like to handle it on the Brush setting, instead. I’d also like to handle it myself to outline multiple hexes around the hex I’m hovering over. I already successfully have the brush painting implemented, but it’s difficult to use because I can’t change the border preview to give a hint of what will change when Paint is called.

I believe this border preview is a gizmo, but it’s difficult to find documentation on this element. Any help would be appreciated.

Thanks in advance,
Jake

8874174--1211802--upload_2023-3-13_19-16-44.png

I think what you’re talking about is the Grid Marquee - if it’s what’s usually a square box at the cursor position when painting on a vanilla rectangular grid.

If that’s what you mean then no it isn’t a gizmo. It’s drawn during a scene view. The code for drawing these various marquees are in ‘internal’ methods in GridEditorUtility and you need to set up a SceneView callback to draw it (ie gets a little complicated, I’ve done this myself). You can access it via reflection but I’m pretty sure that you can’t change the line width.

You could copy the code in the GridEditorUtility and mod it to change the width (I assume that’s OK w/ Unity folks) but you then couldn’t distribute it.

1 Like

I’d suspected this. The good news is that I don’t mind the original marquee still being there, what I really need is the extended brush size. This is a good lead, by backup option was to draw based on the world projection of the mouse, which I don’t want to have to do for obvious performance reasons. Knowing the name of this alone is a huge help, thank you.

If you want some example code that does this, DM me.