- Edited
Hi guys, just to get to the point I have this code that doesnt seam to put the actions in the imput mapping window from code. Is that possible or am I being lazy and should do it manually for every project I make. The thing is the actions doesnt show up in Input.is_action_pressed(), i.e not in the InputMap
tool
extends EditorScript
var controls = {"up":[KEY_W], "down": [KEY_S], "left": [KEY_A], "right": [KEY_D]}
func _run():
var ev
for action in controls:
if not InputMap.has_action(action):
print("adding " + str(action))
InputMap.add_action(action)
else:
print(str(action) + " already exist")
for key in controls[action]:
ev = InputEventKey.new()
ev.scancode = key
InputMap.action_add_event(action,ev)
print("control config complete")