-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot change values wuth ImGui #88
Comments
See #73 (comment) I really need to reorganize and expand the docs to clarify some common issues. |
I found out my way out with this method tho
This is kinda something but good enough for me |
I faced a similar issue while trying to set up a debug menu. Here, I'm trying to update a variable stored in a var menu_is_open: bool = false
var debug_overlay_enable = [false]:
set(value):
# This is never reached
print("Changing value..."])
# "Global" is an autoload
Global.game_settings.debug_overlay_enable = value[0]
debug_overlay_enable = value
func _input(event: InputEvent) -> void:
if event.is_action_pressed("open_debug_menu"):
menu_is_open = not menu_is_open
func _process(_delta: float) -> void:
if menu_is_open:
ImGui.Begin("Debug menu")
ImGui.Checkbox("Enable debug overlays", debug_overlay_enable)
ImGui.End() As suggested by @sinaSPOGames, manually updating the variable works, but is not very elegant : extends Node
var menu_is_open: bool = false
var debug_overlay_enable: Array = [false]
# func _input [...]
func _process(_delta: float) -> void:
if menu_is_open:
ImGui.Begin("Debug menu")
ImGui.Text("Hello world !")
ImGui.Checkbox("Enable debug overlays", debug_overlay_enable)
ImGui.End()
Global.game_settings.debug_overlay_enable = debug_overlay_enable[0] ... and it still requires creating a variable. It would be great to have an easier way of binding the value of ImGui controls to existing variables ! (and I'm glad you're considering improving the docs, that's always appreciated) |
one thing can be done is adding a unique way to access variables in imgui's base code instead of requiring the ImGui.example(example, example[0]) just do the second identifier in code |
i use this following code to change some values that will be important for me to debug on
the problem is none of these values do change no matter what i do, those values arent controlled by anything else unless there is some circumstances for example engine health reduces only if my player's vehicle goes over its RPM capacity (an V8 going over 10krpm)
no matter what i do those values never change
The text was updated successfully, but these errors were encountered: