Skip to content

wolf-org/consolation

 
 

Repository files navigation

Consolation

It's difficult to retrieve logs and warnings from Unity outside the editor. To make it easier, this console displays output from Debug in the game itself. This is especially useful on mobile devices.

Console in Unity game

Installing

1: Download the repo and drop it into folder Assets

2: Add the line below to Packages/manifest.json

for version 1.4.2

"com.matthewminer.consolation":"https://github.com/wolf-package/consolation.git#1.4.2",

Using

Attach the ConsoleInGame component to a game object. When playing your game, open the console window with the back quote key `. This shortcut is configurable in the inspector.

Alternatively, enable shake-to-open in the inspector to open the console on mobile devices. The component provides an option to prevent accidental shakes by requiring 3 or more fingers on the screen.

Several other settings like font size and the maximum log count are also configurable in the inspector.

Screenshot 2024-08-06 165840

Api

  • Toggle on/off console window
     ConsoleInGame.Activate(true);
  • Enable custom size window
    ConsoleInGame.IsCustomSizeWindowConsole = true;
    // Or
    ConsoleInGame.IsCustomSizeWindowConsole = false;
  • Set custom width (only work when EnableCustomSizeWindow = true)
    ConsoleInGame.CustomWidth = 650;
  • Set custom height (only work when EnableCustomSizeWindow = true)
   ConsoleInGame.CustomHeight = 700;
  • Set log font size
    ConsoleInGame.LogFontSize = 20;
  • Set scale factor
    ConsoleInGame.ScaleFactor = 1.5f;

Compatibility

Supports Unity 2017.x and above. It hasn't been tested on all the platforms that Unity supports but it probably works on most.