- Home /
 
Android profiler log file failure
I'm trying to profile my game when it loses internet connection. I can't profile the app directly from the editor when disabling the device's wifi as it breaks the profiler's connection, so I'm trying to write the profiling info to a log file on the device for later analysis by doing:
 Profiler.logFile = "mylog.log";
 Profiler.enabled = true;
 
               as per: http://docs.unity3d.com/ScriptReference/Profiler-logFile.html
However, the file is never written and logcat is spammed with this error:
 E/Unity   (19444): (Filename: PlatformDependent/AndroidPlayer/Source/File.cpp Line: 603)^M
 E/Unity   (19444): ^M
 E/Unity   (19444): Writing failed because the file was not opened^M
 E/Unity   (19444):  ^M
 
               Has anybody every encountered this issue? Any ideas?
Answer by steakpinball · Apr 20, 2015 at 06:02 PM
Documentation states Profiler.logFile is for standalone platforms. It may not work at all on Android. You could try using a full path, i.e. /sdcard/mylog.log 
This works, if you prepend the path with Application.persistentDataPath as follows:
 UnityEngine.Profiling.Profiler.logFile = Application.persistentDataPath + "/" + m_FileName;
                 Your answer
 
             Follow this Question
Related Questions
Android Internal Profiler Interval 1 Answer
Profiler Alpha Mobile 0 Answers
Android Development Build Crashing After Splashscreen 2 Answers
Android build crashes on launch. 2 Answers
How to tell android to open a file 0 Answers