godot-extended-libraries / godot-debug-menu

Display in-game FPS/performance/hardware metrics in a Godot 4.x project
https://github.com/godot-extended-libraries/godot-debug-menu-demo
MIT License
429 stars 16 forks source link

Error when trying to modify `DebugMenu.style` through code #21

Closed adamscott closed 9 months ago

adamscott commented 9 months ago

Error

The example says to use that line in order to set the DebugMenu

DebugMenu.style = DebugMenu.Style.VISIBLE_DETAILED

But this error happens.

Invalid get index 'Style' (on base: 'CanvasLayer').

Cause

It stunned me because the script debug_menu.gd extends Control, not CanvasLayer. But I realized that the instantiated autoload is the scene, not the script. And the root node of the scene is a CanvasLayer.

Calinou commented 9 months ago

Thanks for the report! Consolidating in https://github.com/godot-extended-libraries/godot-debug-menu/issues/15, which was fixed by https://github.com/godot-extended-libraries/godot-debug-menu/pull/16 but isn't present in a tagged release yet.