A downloadable asset pack

Unity-Console

An in-game console for Unity games

Codacy Badge

rotation

custom-methods

log-detail

Setup

Find the latest releases here

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.

Updated 13 days ago
StatusReleased
CategoryAssets
AuthorJavier Bullrich
Made withUnity
TagsUnity, unitypackage

Download

Download
blue-console-1.0.2.unitypackage 257 kB

Install instructions

Setup

Find the latest releases here

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.

Leave a comment

Log in with itch.io to leave a comment.