3

Consolation: In-Game Console for Unity

 3 years ago
source link: https://matthewminer.com/2017/03/07/consolation-in-game-console-for-unity
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Matthew Miner

Consolation: In-Game Console for Unity

March 7, 2017

After creating a fresh Unity project, the first script I add is Consolation, a helpful tool I built that displays an in-game debug console. It uses a tremendously handy but seemingly little-known feature of Unity called — I hope you’re sitting down for this — Application.logMessageReceived. Attach a delegate to this event, call Debug.Log, and do whatever you please with the incoming messages. In Consolation’s case it collects them in a window for your enthusiastic perusal.

Consolation

An in-game debug console is mostly useful when running your game outside the Unity editor, e.g. when testing a beta build. Something wonky happens? Press ` or shake your mobile device to see the warnings and errors your game threw. The adventurous among us might use this juicy info to fix the problem. But let’s not get too crazy.

Open Unity’s Asset Store and you find a plethora of in-game debug consoles. I bet they’re terrific. This one is free. Drop the self-contained script into your project, attach it to a game object, and you’re ready to rumble. It’s also open source and welcoming of pull requests, so fork away you magnificent creature.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK