Show error when running in Application.

It’s easy to show some “Error” or Debug information in debug mode when it will be print in Console window.

But is there any way to show these things when running Application ?Because I found when it run fine in
Debug mode,it may still some error run in application, if it can show something wrong or Debug information, it will be help for finding the problem.

Although we may use “try{}catch{}” to do the Exception,But is there any good way to do that?

You can make your own console in-game. It also helps you to better debug. I share you my script:

using UnityEngine;
using System.Collections;

public class Console : MonoBehaviour {
	float height = 150f;
	static private string text = "Unity Console v1.4.567

Vector2 scrollPosition = new Vector2(0,0);

	void OnGUI() {
		scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width (Screen.width), GUILayout.Height(height));
		GUILayout.TextArea(text, GUILayout.MinHeight(height));
	static public void Add(string line) {
		text = text + line + "


To use it, just attach this script to a GameObject and call Console.Add.


A more elegant solution that doesn’t require you to add a console to the game is to locate the error log files. They are described in this page: Unity - Manual: Log files