Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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.

About

An in-game console for Unity games

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages