1
\$\begingroup\$

I made a hexagonal button, with a png image, the problem is that if i click outside of the image of the hexagon(but still inside of the squared area that defines the whole button), the click is registered , if i click inside of the button nothing happens, now i just read in the docs about the property Click Mask, so i made the same image of the hexagon shape into a bitmap, but this error text comes up:

The selected resource (StreamTexture) does not match any type expected for this property (BitMap).

I used this linkt as a guide to create the bitmap, http://www.herongyang.com/Windows/GIMP-JPEG-Save-Image-in-BMP-Format.html, still i don't know what i'm missing. Also used MS Paint to save it as bitmap, but that din't work either.

Why i can't load the image as Click Mask in Godot?

I attached the image for testing.

enter image description here

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

It seems you don't have it imported as BitMap. You will have to change the way it is imported. Make sure to save your project without continuing.

To make Godot import the image as Bitmap select the image in the FileSystem panel (on the bottom left by default), then go to the Import panel (on the top left by default, it shares dock with the Scene panel), there in "Import As:" select "BitMap", then set "Create From:" to "Black & White", and click "Reimport".

Godot should be able to import PNG as BitMap. It does not have to be a BMP.

Once you have it imported as BitMap, assign the image to the "Texture Click Mask" property of the TextureButton on the Inspector panel (on the top right by default). You can drag the image from the FileSystem panel.

\$\endgroup\$
3
  • \$\begingroup\$ That did it! Unfortunately the button still not working as intended, the visible area of the button is the one that get the mouse click registered, even with inverted color white/black, still happens the same \$\endgroup\$
    – Progs
    Feb 24, 2021 at 19:42
  • \$\begingroup\$ @B.J.A.A. I tried setting the the texture on a button and it seems to work correctly for me. I can only assume something is messing it up. Perhaps something to do with Mouse Filter? Don't know. Try making a minimal example. A project with just the button. And work from there (Edit: I mean to try to find what is messign it up). If the minimal example does not work either, I guess you could open an issue of Github. \$\endgroup\$
    – Theraot
    Feb 25, 2021 at 1:16
  • \$\begingroup\$ it works now! i forgot to chagen black&white to alpha \$\endgroup\$
    – Progs
    Feb 25, 2021 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .