[Feature Request]Customizing the Tile Palette "Scene"

I would like to be able to add my own gizmos, labels, etc to the “scene” or window the tile palette runs in. While this functionality does appear to exist in OnPaintSceneGui(),

OnPaintSceneGui()

public override void OnPaintSceneGUI(GridLayout grid, GameObject brushTarget, BoundsInt position, GridBrushBase.Tool tool, bool executing)
    {
        base.OnPaintSceneGUI(grid, brushTarget, position, tool, executing);
        //if (brushTarget.scene.name != "Preview Scene") {
        //    Handles.Label(grid.CellToWorld(position.position), position.position.AsVector2Int().ToString());
        //}
        //else
        //{
            var tileName = ((AdvancedTileBrush)target).cells[0]?.tile?.name;
            //if (tileName != null)
            //{
                Handles.Label(
                   grid.CellToWorld(position.position)
                    , "test",//tileName,
                    new GUIStyle
                    {
                        fontSize = 30,
                        fontStyle = FontStyle.Bold,
                        normal = new GUIStyleState { textColor = Color.white }
                    });
            //}
        //}
    
    }

I have found that it only works for the select tool and somewhat randomly at that - the label is only drawn sometimes:
4843715--465512--current palette.PNG
In my case, the label only appears when I have the select tool enabled and when I click on a tile. Furthermore, the label is not always visible for every tile. The label should always be shown.

Something like this is what I want - The ability to add text or gizmos:
4843715--465533--Wanted.png

Just to reiterate, I want to have the same capability for scene tooling that exists in any standard scene. The tile palette seems to run in its own weird “Preview Scene” so technically, this should already be possible.

@ChuanXin Sorry, I just realized I probably need to post this in 2D Preview. Apologies for the mention, but this is really important to me.

Thanks for your suggestion! We will look into adding this to improve the Tile Palette window.

Would these gizmos and labels be specific to the brush or tool mode you are using or be applied to the Tile Palette on the whole?

1 Like

Currently, it seems that the Tile Palette runs in its own scene. I think the best approach might be to use the existing functionality of gizmos and editor customization for standard scenes. If this cannot be done, then yes, I think the best approach may be through a custom brush. It is already possible to populate scenes with brush data (The 2d extras, Coordinate Brush is a great example of this). The code I posted above does paint the 2d coordinates “test” on the scene. The problem is that is doesn’t always work in the palette preview scene.

To summarize and answer your question, I believe the brush approach might be a good one. Brushes only exist in the context of editing as far as i’m aware and are only applicable within the editor. If possible, the existing custom inspector workflows should be leveraged so that the tile palette scene can be augmented with labels and gizmos.

Yes, there is a unique scene that the Tile Palette uses with a simple rendering pass to get the Tile Palette image. We will try to see if the SceneView gizmo rendering workflow will work with the Tile Palette and its scene.

1 Like