Godot Version
4.6
Question
I had this problem in godot 4.5 and the code below somehow stop it. After migrating project to 4.6 I dont know if i changed the code or something changed internally.
4.6
I had this problem in godot 4.5 and the code below somehow stop it. After migrating project to 4.6 I dont know if i changed the code or something changed internally.
I think you also need to check for event.is_pressed(). Otherwise it will include key releases, which could be the cause of your issue.
Yes, the problem was I was getting two inputs for both pressing and releasing the input keys.
here the updated code.
func _unhandled_input(event: InputEvent) -> void:
# Starts the renaming of the current Load File
if event.is_action_pressed("f2"):
var result := cast_ray()
if not result: return
var lab = result.collider.get_parent().get_child(-1)
if lab is Label3D:
get_input = true
label = lab
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
# Stores the input into a String
if get_input and event is InputEventKey and event.is_pressed():
var input := OS.get_keycode_string(event.keycode)
if event.is_action_pressed("ui_text_backspace", true) and label.text:
label.text = label.text.erase(label.text.length() - 1, 2)
elif event.is_action_pressed("ui_cancel") or event.is_action_pressed("ui_accept"):
get_input = false
if label.text == "": label.text = "NEW SAVE"
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
elif label.text.length() == 16: return
elif input.length() == 1: label.text += input
return
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.