Material Box

Material Box

WEB Design & Material Images

Godot - Disabling the Focus Style of a Button

Godot

This code example shows how to disable the focus style of a Button node using GDScript.


To disable the focus style of a Button, use add_theme_stylebox_override() with `StyleBoxEmpty` for the focus style.
If you use `StyleBoxFlat`, the default style will be applied, so you need to change it to the same style as `normal`.

# Create a Button node
var button = Button.new()
add_child(button)
button.set_text("Button")
button.set_size(Vector2(200, 200))

# Disable the focus style
var focus_style = StyleBoxEmpty.new()
button.add_theme_stylebox_override("focus", focus_style)

Godot

TitleGodot - Disabling the Focus Style of a Button

CategoryGodot

Created

Update

AuthorYousuke.U