Hello! I'm starting with Godot. I want to know how can i change a button texture at a function. I have button at my Game scene. And I want that at func game_over() my button changes the texture to another image. Some idea for coding this? Thanks in advance!

  • If it's a TextureButton, you should be able to do this:

    # Untested code
    texture_normal = load("res://image.png")

    https://docs.godotengine.org/en/4.1/classes/class_texturebutton.html

    It's more efficient to have the textures preloaded into variables, so that the image file doesn't have to be loaded at run time.

If it's a TextureButton, you should be able to do this:

# Untested code
texture_normal = load("res://image.png")

https://docs.godotengine.org/en/4.1/classes/class_texturebutton.html

It's more efficient to have the textures preloaded into variables, so that the image file doesn't have to be loaded at run time.