Add a console for your project that can be used for ex. debugging.
- Run commands and execute code with text inputs.
- Easy to customise your own commands.
- Unity events hooked up to commands with individual tags.
- Get log messages inside the game.
Use commands to change settings or you can easily change setting in the json file created in your Application.persistentDataPath after first use.
- Import this package by downloading it and add it with the unity package manager or by adding a git repo
- Add the GDConsole prefab to a scene
- Mark your methdos with [ConsoleAction] attribute to add them as a command. Static methods and methods inside a Monobehaviour will work without further modification, methods inside other objects need a reference.
- Press play and enter the command name in the console.
Look in the DemoScene for examples.
You can create your own commands easily. Add [ConsoleAction] to any method in your scripts. You can also overwrite the name of the method and parameter aswell as adding a description [ConsoleAction(Command = "command name", Description="command description", ParameterNames = new string[]{"param1","param2"}]
If your methods are static ones they work as soon a you mark them with the attribute.
When executing a command that exist on a MonoBehaviour the CommandManager will use the first GameObject (of correct type) it finds.
You can specify a certain GameObject be enterint @gameobjectname when entering a command. The @ is for identifying that its a name and can be changed in the prefab.
If your method belongs to any other object you need to registrer that object in the CommandManager with RegisterObjectInstance(object) method. This will register the object to all commands related to this object.
The UI is a simple window with an input field and a message area, all configurations are made with commands or changing the settings.json file in the persistant data path.
Toggle visibilty with "§" or BackQuote, can be changed.
Based on parts of code from https://github.com/yasirkula/UnityIngameDebugConsole