Is it possible to access InputMap actions in exported properties?

You can get the inputs from the game using ProjectSettings like this:

func _get_property_list():
	var actions = []
	for prop in ProjectSettings.get_property_list():
		var prop_name:String = prop.get("name", "")
		if prop_name.begins_with('input/'):
			prop_name = prop_name.replace('input/', '') 
			prop_name = prop_name.substr(0, prop_name.find("."))
			if not actions.has(prop_name):
				actions.append(prop_name)
	
	var hint_string = ",".join(actions)
	
	var properties = []
	properties.append({
		"name": "prompt_action",
		"type": TYPE_STRING_NAME,
		"hint": PROPERTY_HINT_ENUM,
		"hint_string": hint_string
	})
	return properties
3 Likes