In-game console for Godot, easily extensible with new commands.
-
Writing to console using
write
andwriteLine
method. You can use BB codes. (Also printed to engine output)Console.writeLine('Hello world!')
-
Auto-completion on
TAB
(complete command),Enter
(complete and execute). -
History (by default using with actions
ui_up
andui_down
) -
Custom types (
Filter
,IntRange
,FloatRange
, and more...)
- Clone or download this repository to your project folder.
- Add
src/Console.tscn
to godot autoload asConsole
. - Add new actions to Input Map:
console_toggle
,ui_up
,ui_down
func _ready():
Console.register('sayHello', { # Command name
'description': 'Prints hello world',
'args': [ARGUMENT, ...],
# This argument is obsolete if
# target function doesn't
# take any arguments
# [Object, variable/method name]
'target': [self, 'print_hello']
# Target to bind command.
# Providing name is obsolete
# if command name is same.
})
func print_hello():
Console.writeLine('Hello world!')
ARGUMENT should look like this:
More information about ARG_TYPE you can find in this readme.
You can find more examples in src/BaseCommands.gd
Great thanks to @Krakean and @DmitriySalnikov for the motivation to keep improving the original console by @Calinou.
Take a look at their implementations.
Licensed under the MIT license, see LICENSE.md
for more information.