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")

@TwistedTwigleg said: I have not gone through it myself, but this tutorial on KidsCanCode looks like it shows how to add Input actions in code using GDScript: Adding Input Actions in Code

Its basically the same as what I did but what I wanted was for it to show up in the Editor, where we would normally make them.

Thing is this does work but godot's "inteliscene" doesnt show them in the options when typing

Oh, I see. You could try running the script in tool mode or telling the Godot editor to run the script and see if that works.

@TwistedTwigleg said: Oh, I see. You could try running the script in tool mode or telling the Godot editor to run the script and see if that works.

Yeah thats what i did. I ended up just putting the function in myu player script and call it at runtime work but doesnt show up in the editor InputMap

2 years later