Skip to content

Bullrich/Unity-Console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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