How can I make custom Buttons?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By System_Error

Hi all.

In a game I’m putting together, I’d like to make some custom buttons. I think TextureButton is the right node, but I don’t know how to use it for buttons with a single, custom texture. The code below is for the GUI, aptly called

extends CanvasLayer

signal play_game

func show_message(text):
	$SystemMessage.text = text

func player_loss():
	show_message("Game Over")
	yield($MessageDuration, "timeout")
	$SystemMessage.text = "New Game?"

func score_count(score):
	$TimeSurvived.text = str(score)

func _on_MessageDuration_timeout():

func _on_Button_pressed():

I’d like to be able to make my own buttons, and know where they’d go in my current project.

I know how to use the signals, so I can connect those to what they’re going to move. Just working out how to best have the buttons…

System_Error | 2018-12-15 22:43

:bust_in_silhouette: Reply From: rojekabc

If you create a button node (as you wrote - TextureButton), you may select in properties your own set of Textures. But if you wish to prepare something like your own styled button - create and set your own Theme. You may also always play with Material and create your own shader. Everything depends on this what you wish to create exactly.
Theme or Shader you may always save as a file and use on another button, that you create.