Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity3D/Xcode: Debug Logs not available on Device, can't see in Console

I'm having a pretty strange issue I haven't encountered before in Unity - I'm unable to get my Debug.Log() calls, or my NSLog() calls from Unity and Xcode to display to the console when I build the application to my device.

Here's what I've been trying so far:

  1. Build to Xcode from Unity with the Development Build and Script Debugging options enabled (tried using both 'Build' and 'Build and Run', no difference).
  2. From Xcode, I've tried just building by using Product->Run (CMD+R) with my device plugged in via USB. I've also tried Product->Archive and installing the .ipa file manually, neither have worked.
  3. Plugged in Device and attempted to retrieve logs from Xcode's default console, the Organizer window by selecting 'Console' under my Device, and using the iPhone Configuration Utility.

The only output I get from my application is this line in the main.mm file generated by Unity in the Xcode project:

NSLog(@"-> registered mono modules %p\n", &constsection);

I don't see the other default logs and prints that are in the project by default either, such as the following line in UnityAppController.mm:

printf_console("-> applicationDidFinishLaunching()\n");

The odd thing is, I saw all of these logs and my own at one point very early on the in the project, but now I no longer do. I've tried stepping back and reverting to an earlier build, but I'm still not seeing any logs. I've also tried building to a new Xcode project and building that to my device, but with no luck either.

What are some things I could be missing? I've looked over as many other topics as I could and tried several suggestions, but haven't been able to find anything so far. Is there any reason I would receive the first debug log from Unity about registering mono modules but none of the others? I can't find a good reason, and its making my debugging on the device a living pain without them.

For reference, I'm using Unity 4.5.1 and Xcode 5.1.1.

like image 883
Retribution Avatar asked Sep 06 '25 08:09

Retribution


1 Answers

Have you tried attaching to the Unity log message event?

public Text logText; //someRandomUnityUITextThatIsShownOnScreen 

void Start(){
Application.logMessageReceived += HandleLog;        //can disable logging with Application.logMessageReceived -= HandleLog; 
}

void HandleLog(string logString, string stackTrace, LogType type)
{
  logText.text += "\n | " + logString; 
//of course you can use the logstring and stacktrace to do whatever you want, write into a debug txt file or smth.
}

if that doesn't work either, it is probably an iOS bug right now

like image 160
Kjell Schwaricke Avatar answered Sep 07 '25 21:09

Kjell Schwaricke