-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] Reset to default #56
Comments
I'm not sure if this is really required feature but I would like to hear what others (lets hope there are others)) have to say. Generally I would suggest removing commands yourself by subscribing to node destruct signal since it is faster, it should make code clearer that when you register command and remove it on node removal. But if you absolutely need to remove everything besides default commands I can come up with this quick solution: const CommandCollection = preload('res://addons/quentincaffeino-console/src/Command/CommandCollection.gd')
func remove_custom_commands():
Console.get_command_service()._command_collection = CommandCollection.new()
Console.BaseCommands.new(Console) (haven't actually tested this code, wrote it right here in gh issues) But this solution might stop working anytime since it's using private interfaces so I highly suggest considering the first solution. |
I think this function would be useful. (If it is not too complicated to implement) |
@andersmmg, maybe you can use the function However, a function to reset could be pretty useful. |
Something like
Console.reset_to_default()
to remove all commands besides the default ones.My player character is creating console commands, but when I switch levels or go to the menu, all the commands break because they can't find a reference. Also, in the menu, commands relating to the player or gameplay shouldn't work anyway, and it's a lot to remember to remove each command manually when the scene changes, and adding a call for each new command I create.
The text was updated successfully, but these errors were encountered: