Search Unity

Opening SpriteEditor to select one sprite of spritesheet from custom Inspector button

Discussion in 'Editor & General Support' started by Lo-renzo, Jan 17, 2020.

  1. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,514
    I'd like to replicate this feature of the Unity Tilemaps that's really nifty and a huge time-saver for my own custom Inspectors. The default Tile that's generated when dragging a sprite into a Tile Pallete comes with a custom inspector with a button, "Sprite Editor", that opens the Sprite Editor for the specific sprite assigned to that tile. It's immediately ready to adjust its rect's borders, rename or whatever.

    I'd like to sprinkle my own version of this all over my Inspectors because it saves a bunch of clicks, and I'd also click to add shortcuts like CTRL+Click on a sprite in an array to auto-navigate to the exact sprite within its spritesheet. This would be very useful because currently clicking on a sprite like that navigates to the sprite within the Project window, but doesn't open the editor for it, and in large spritesheets there's too much scrolling first within the project, then within the spritesheet, and this button solves all those problems if I could only replicate it.

    However, I cannot find any public API to replicate this, either to open the SpriteEditor or then navigate to a specific sprite within it. Has anyone done anything similar or would someone from the Unity team care to share how this button could be replicated?