Tilemap custom grid brush - two instances in Tile Palette brush selector

Hi

I’ve been experimenting with custom Grid Brushes for a while.

So far I’ve understood the brush creation (practical side) works like this:

  • Create the code class file
  • Add CustomGridBrushAttribute above the class
  • Create the brush ScriptableObject Asset file

But for some reason, I have two instances of my custom brush in Tile Palette Brush selection dropdown. However, I can’t find another copy of Asset in my project and I shouldn’t have two similar GridBrush derived classes either with the same attribute.

Have I missed or messed up something in my project? If not, how should I be able to remove the extra copy?

5262245--526466--customBrushDuplicate.png

Could you share the flag properties of the CustomGridBrush attribute you have placed?

The main two properties would be:
hideAssetInstances: Hide all asset instances of this brush in the tile palette window.
hideDefaultInstance: Hide the default instance of brush in the tile palette window.

If I am not wrong, one of the instances you have is the asset and the other would be the default instance (The Tile Palette instantiates this for you if you do not need to store custom properties for this brush as an asset). You can disable either type by setting the hide flag for them, which in this case would be the default instance for you?

1 Like

You are right - It was the default instance.

I probably have dabbled with those flags and then forgotten about those totally!

Thanks!

@ChuanXin

BTW I did ask another question related to brushes - about using editor keyboard events with Grid Brushes, however I haven’t got any answers to it yet :wink: So far my solution was to use OnSceneGUIDelegate of editor and then some of the events seem to work when brush is active:

Then again, when I created some helper methods, I noticed I could abandon using brushes altogether but it would be nice if somehow it is possible to use more modifier keys / keyboard events with custom brushes.