Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Feature Request]Customizing the Tile Palette "Scene"

Discussion in '2D' started by spryx, Aug 10, 2019.

  1. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    326
    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(),

    Code (CSharp):
    1. public override void OnPaintSceneGUI(GridLayout grid, GameObject brushTarget, BoundsInt position, GridBrushBase.Tool tool, bool executing)
    2.     {
    3.         base.OnPaintSceneGUI(grid, brushTarget, position, tool, executing);
    4.         //if (brushTarget.scene.name != "Preview Scene") {
    5.         //    Handles.Label(grid.CellToWorld(position.position), position.position.AsVector2Int().ToString());
    6.         //}
    7.         //else
    8.         //{
    9.             var tileName = ((AdvancedTileBrush)target).cells[0]?.tile?.name;
    10.             //if (tileName != null)
    11.             //{
    12.                 Handles.Label(
    13.                    grid.CellToWorld(position.position)
    14.                     , "test",//tileName,
    15.                     new GUIStyle
    16.                     {
    17.                         fontSize = 30,
    18.                         fontStyle = FontStyle.Bold,
    19.                         normal = new GUIStyleState { textColor = Color.white }
    20.                     });
    21.             //}
    22.         //}
    23.    
    24.     }

    I have found that it only works for the select tool and somewhat randomly at that - the label is only drawn sometimes:
    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:
    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.
     
    Last edited: Aug 10, 2019
  2. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    326
    @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.