Unity Console by Bullrich - 6

Games & Projects

An in-game console for Unity games

Unknown VersionMIT LicenseUpdated 2 years agoCreated on March 25th, 2017
Go to source

Unity-Console

An in-game console for Unity games

Codacy Badge

rotation

custom-methods

log-detail

TOC

Setup

Download the latest release

To setup the Console, simply drag the prefab Console Prefab from Blue/Console directory to the scene.

To see the stack trace in a build be sure to have “Development build” toggled on.

Adding methods

To add a method simply type:

Blue.GameConsole.AddAction(method, buttonDescription);

Currently, the console accept four types of delegates:

  • Void
  • Bool
  • Int
  • Float

The following methods are used to add buttons to the console:

// Void
Blue.GameConsole.AddAction(voidMethod, "Description");

// Bool
Blue.GameConsole.AddAction(voidMethodThatReceivesABoolean, "Description", defaultValue = false);

// Float
Blue.GameConsole.AddAction(voidMethodThatReceivesFloat, "Description", defaultValue = 0f);

// Int
Blue.GameConsole.AddAction(voidMethodThatReceivesInt, "Description", defaultValue = 0);

A simple example would be:

bool gateStatus = true;

void Start(){
    Blue.GameConsole.AddAction(ChangeGateStatus, "Change the gate status", gateStatus);
}

void ChangeGateStatus(bool newStatus){
    gateStatus = newStatus;
}

This will add a button with a boolean parameters set, by the default parameter, to true.

When that button is pressed the ChangeGateStatus method will be called with the new boolean value.

You can find an example of adding methods in Demo.cs

Sending a custom message

The console allows to receive custom messages, this can easily be achieved with the following method

Blue.GameConsole.WriteMessage("Title", "Message");

The message will appear as a information message in the console.

Show all projects by Bullrich