[SOLVED] UI / Button question

Hi there, I’m new to PlayCanvas.

I’ve been trying to build a UI menu for a game. I want to have a button which looks like this:
image
I am aware it is not possible to do this directly through the PlayCanvas editor. Would I need to create a sprite for this? If so, what program is recommended for making UI sprites?

Many thanks

Just a note, the black colour is the website background, not part of the button itself

Hey @marble,

you can use program like Photopea or Gimp to create UI sprites
Photopea: https://www.photopea.com/
Gimp: https://www.gimp.org/

Other option is to programmatically create UI with HTML/CSS

1 Like

Hi Lukas, thank you for your help

1 Like

Hi @marble and welcome!

If it is a fixed button you can use an entity with an (image) element component and upload your image to it. You can also add a child entity with a (text) element component for your text.

https://developer.playcanvas.com/en/tutorials/ui-elements-buttons/

2 Likes

Can I skip the 9-slicing part because my button does not have a border?

Yes, you can use a normal image as background. If you upload an image you can right click on the image to create for example a sprite asset. You can also use a simple color as background.

1 Like

Thank you, I appreciate your help :smile:

1 Like


Yay! It worked :slight_smile: I made the components in Penpot (open source Figma alternative) and then exported them as PNGs

3 Likes

Nice, good job! :ok_hand:

1 Like