Easy to use Unity package for debugging in game
You can clone or download the project directly, or download the package from releases section and import it to your project.
After importing the package into your Unity project, drag the UnityLog prefab into your scene.
You may see this chat bubble in your game view now.
If this blocks your view, you can select the bubble from the hierarchy and drag it anywhere you would like (e.g. offscreen). This will have no effect for the runtime since UnityLog will arrange it's layout automatically when the game starts.
Click on the UnityLog gameobject in the hierarchy and you will see some properties in the inspector.
-
With don't destroy on load enabled, UnityLog will persist after scene transitions. Any other instances of this prefab will destroy itself.
-
If you want UnityLog to operate on spesific scenes, you can place the prefab to those scenes and remove the don't destroy on load ticks.
-
You can also change the other self explanotary properties as you wish.
Use UnityLog namespace on the scripts which you desire to send debug messages.
using UnityLog;
Log.DebugLog is a static method for debugging which takes an object as a parameter, just like Unity's regular Debug.Log method.
void SendMessage()
{
Log.DebugLog("Hello, World!");
}
void PrintPosition()
{
Log.DebugLog(transform.position);
}
-
UnityLog will automatically arrange it's layout based the screen. It will update itself when screen dimetions change, such as game window in the editor or screen orientation on handheld devices.
-
UnityLog requires EventSystem in order to operate. After a new scene is loaded if there is no EventSystem in the scene, UnityLog will automatically create one.
-
You can see the sample scene in Assets/UnityLog/Samples folder.