- Home /
Debug.Print not working
I'm trying to create a side menu hub that contains a vertical scrollable list of menu items with icons and no text. I have a game object that I created to represent this menu and I created the following script to show the first button:
#pragma strict
//not implemented yet
var selectObjectIcon : Texture2D;
var buttonDimensions : float;
var buttonStyle : GUIStyle;
function OnGUI () {
Debug.Log("testinggg!");
if(GUILayout.Button("testing if i can click this")){
Debug.Log("i can click this!!");
}
GUILayout.BeginArea(Rect(Screen.width-buttonDimensions, 0, buttonDimensions, Screen.height));
GUILayout.BeginVertical();
if(GUILayout.Button(selectObjectIcon, buttonStyle)){
Debug.Log("select object pressed");
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
and I attached it to my menu game object. The menu appears correctly but none of the debug statements are being printed to the command line when I deploy on my Android device. If I play in Unity, all the debug messages are printed to the command line. Why are they not appearing when I deploy to an actual device and how can I fix that?
Answer by meat5000 · Oct 12, 2013 at 06:57 PM
You can view Debug logs in Android through Eclipse using LogCat
I am using this method now, but to further clarify, I had to run something like "logcat -s Unity" so that I could filter out a lot of the noise.
Answer by Crystalline · Oct 12, 2013 at 06:53 PM
As far as I know on Android you cannot view debug logs.
You can always create one manually.
var debuglog : GUIText;
function OnGUI ()
{
if (GUI.Button(Rect(0,0,128,128),'button'))
{
debuglog.text = 'mylog';
}
}
Answer by lakeman · Nov 05, 2015 at 09:29 AM
You can use adb logcat to view logs on android devices.
But the most convenient way is this: https://www.assetstore.unity3d.com/#!/content/44935