Trouble with TextureButton

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

Hello everyone, I want to show the button menu, if my ship is destroyed.

I have this but it doesn’t show, but also can’t display any errors:

func _ready():
	connect("pressed", self, "_on_pressed")
	attach("ship", "exit_tree", self, "_on_ship_exit_tree")
func _on_pressed():

func _on_ship_exit_tree():

Any help?

What does the attach function do? I’m expecting it should do something similar to connect but I can’t be certain, and I would say that it is the root cause of your problem, either that or your shit is never leaving the tree.

Also, you do not need to use pass at the end of every method. It is just a keyword used to enable empty methods.

tastyshrimp | 2019-12-19 21:39

:bust_in_silhouette: Reply From: SuperDIMMaX

Try use “visible”.

func _ready():
    $TextureButton.visible = false
    $TextureButton..disabled = true #prevent press
func _on_ship_destroy():
    $TextureButton.visible = true
    $TextureButton..disabled = false
    # some other func - score, particles ...