godot: Default InputMap action events can't be easily removed

Steps to reproduce:

  • open any project in the editor
  • open the project settings and delete one of the events from ui_accept
  • save
  • close the editor and re-open again
  • The deleted action is still in the InputMap and engine.cfg

The only way to delete those right now is to add a new temporary action after the removal (which can then also be deleted)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (13 by maintainers)

Most upvoted comments

This is not really a bug, Godot UI needs these actions so you can’t remove them. You can change what keys are used though, but there is not any benefit to removing them.

just to share a scripted workaround :

func _ready(): #{
    for action in ["ui_accept","ui_select","ui_cancel","ui_focuse_next","ui_focus_prev","ui_left","ui_right","ui_up","ui_down","ui_page_up","ui_page_down"]: #{
        if InputMap.has_action(action):
            InputMap.erase_action(action);
        InputMap.add_action(action); # <-- to avoid reading complaints about  "Request for nonexistent InputMap action:ui_xxx"
    #}
#}

I confirm that #21008 keeps this issue fixed, so basically this seems to be implemented already:

Add logic to allow editing events of ui_* actions from the project settings dialog, and then save only the modified ui_* actions.

Actually as discussed with @groud, it’s a “bug” that this issue is fixed, and we’re about to fix it, so this issue will reappear.

Currently it’s fixed because all ui_* actions get saved to project.godot, due to their new 3.1 format differing from the 3.0 format still used in ProjectSettings’ constructor. Once we fix the constructor, those ui_* actions should no longer be saved to project.godot in new projects.

From there, there will be two options:

  • Add logic to enforce saving ui_* actions to project.godot, even if they match their initialization. That will bring back the current status, but it’s a lot of noise in the project.godot file when you don’t want to edit those (most of the time), so it’s annoying.
  • Add logic to allow editing events of ui_* actions from the project settings dialog, and then save only the modified ui_* actions.

Well, I screwed up on the wording a bit in the original post… what I meant was not deleting the default actions, but the events associated with them. Which is a totally fine use-case IMO. Hence why I reopened the issue.