Godot Engine v3.2.stable.official
Adding a panel via inspector and changing it's color to red works fine through:
var new_style = StyleBoxFlat.new()
new_style.set_bg_color(Color(1, 0, 0, 1))
$Panel.set("custom_styles/panel", new_style)
Using exactly the same approach, but creating the panel through code doesn't seem to work. In fact there is even no default background visible:
var panel = Panel.new()
self.add_child(panel)
var new_style = StyleBoxFlat.new()
new_style.set_bg_color(Color(1, 0, 0, 1))
panel.set("custom_styles/panel", new_style)
What gives? Tried:
- Adjusting the size of this latter panel (default was (0, 0))
- Toggling visibility off/on
- Calling panel.get_stylebox('panel')
before and after setting the
stylebox to verify the stylebox has been changed
- Calling panel.update()
also doesn't seem to fix it
Missing something obvious? Looks like the panel is there, it's just invisible.