All Projects → gzuidhof → Gconsole

gzuidhof / Gconsole

Licence: mit
Developer Console for Unity3D

GConsole

GConsole is an ingame developer console for the Unity3D Engine.

Here are some screenshots:

##Why? A proper console solution didn't exist (in my eyes) on the asset store, and I can't live without one. Having a developer console ingame is great for debug purposes, and for your final product too.

See, for instance, Valve's game developer console, which prints information that is otherwise not visible to the user and allows the user to send "advanced" commands, for instance changing a setting.

##Features

  • GUI framework agnostic
  • Easy to use
  • Drag 'n' drop "installation"
  • Suggestions feature
  • Hooks into Unity logger (if you want it to), including stacktraces.
  • Customizable, supports colored text
  • Free and open source!

##UI

###Available UI Front-ends:

##Usage ###Setup

  • Download this repository, put the GConsole folder somewhere in your project.

  • Pop a GConsole script on any (enabled) GameObject in your scene (or drop in the provided prefab).

  • Download a frontend.

  • See frontend page for further steps.

###Printing to the console.

GConsole.Print("Hello world");

###Adding a command

GConsole.AddCommand("quit", "Quits the application.", QuitApplication);
  • The first argument is the command name
  • The second argument is a description
  • The third argument is a method which returns a string and takes one parameter: a string. It doesn't matter whether it's private, internal, protected or public. What this method returns is what is printed to the console.
  • (OPTIONAL) Fourth argument is additional help text. Shown when the user types help <commandname>.

Full Example

public class GConsoleQuit : MonoBehaviour {

	void Start () {
	    GConsole.AddCommand("quit", "Quits the application.", QuitApplication);
	}

    string QuitApplication(string param)
    {
        if (Application.isWebPlayer || Application.isEditor)
        {
            return "You can't quit in a webplayer build, just close this window!"; //Or in the editor, but lets not print that.
        }
        else
        {
            Application.Quit();
            return null; //No point in returning a message if the application has already shut down.
        }
    }
}

###Dynamically calling a command If for some reason you want to call a command dynamically (from code, perhaps from some sort of script file), you can do that.

GUIConsole.Eval(cmd);

Where cmd is a string, just like the user would have typed it into the console.

This returns the output of this command (useful if you want people to be able to use console commands from say, a chat window, where if they prepend a "/" it's evaluated by the console, and then you print what this returns in that window).

##Contribution Guidelines Any contributions are welcome, including feature requests.

##Contributors Rahazan (Guido Zuidhof) TarasOsiris (Taras Leskiv) MuNgLo baguwka

##License

MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].