Hi there!
Sorry for the noob question, but how to I view Debug.Log when I have built the game as an .APK on an Android device? If there is something else than Debug.Log, what is it? I just need to log some lines in my script while it is running on an Android device(NOT EDITOR) since I’m having issues with Google Play Leaderboard login.
Thank you so much!
using UnityEngine;
using System.Collections;
public class GuiTextDebug : MonoBehaviour {
private float windowPosition = -440.0f;
private int positionCheck = 2;
private static string windowText = "";
private Vector2 scrollViewVector = Vector2.zero;
private GUIStyle debugBoxStyle;
private float leftSide = 0.0f;
private float debugWidth = 420.0f;
public bool debugIsOn = false;
public static void debug(string newString)
{
windowText = newString + "
" + windowText;
UnityEngine.Debug.Log(newString);
}
void Start () {
debugBoxStyle = new GUIStyle();
debugBoxStyle.alignment = TextAnchor.UpperLeft;
leftSide = 120; //Screen.width - debugWidth - 3;
}
void OnGUI () {
if (debugIsOn) {
GUI.depth = 0;
GUI.BeginGroup (new Rect(windowPosition, 40.0f, leftSide, 200.0f));
scrollViewVector = GUI.BeginScrollView (new Rect (0, 0.0f, debugWidth, 200.0f), scrollViewVector, new Rect (0.0f, 0.0f, 400.0f, 2000.0f));
GUI.Box (new Rect (0, 0.0f, debugWidth - 20.0f, 2000.0f), windowText, debugBoxStyle);
GUI.EndScrollView();
GUI.EndGroup ();
if (GUI.Button(new Rect (leftSide, 0.0f,75.0f,40.0f), "Debug")){
if (positionCheck == 1){
windowPosition = -440.0f;
positionCheck = 2;
}
else {
windowPosition = leftSide;
positionCheck = 1;
}
}
if (GUI.Button(new Rect (leftSide + 80f,0.0f,75.0f,40.0f),"Clear")){
windowText = "";
}
}
}
}
This is an older code but should still work just add it a game object.
Let me know if this worked for you!
Darsak
February 9, 2016, 9:25am
3
@putin2001 You can use adb command to view android device logs.
open command prompt/ terminal of your system and use adb logcat command to view logs.