I use this code to get Binary Log in Unity 2017.3.0f3:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class test : MonoBehaviour {
void OnGUI() {
if (GUILayout.Button("Start record")) {
Profiler.logFile = "P1.log";
Profiler.enableBinaryLog = true;
Profiler.enabled = true;
}
if (GUILayout.Button("Stop record")) {
Profiler.enableBinaryLog = false;
Profiler.logFile = "";
Profiler.enabled = false;
}
}
}
When I push the “Start record”,it is working,After I push “Stop record”,a file named “P1.log” file is created but not a file named “P1.log.data”.If I use Profiler.AddFramesFromFile(LogPath) to input “P1.log” to Profiler,I will get a error:Error while reading file ‘D:/TestProject/P1.log’. Invalid signature.
Why does this happen?It happened in 2017.3.1p1,too.Before this I didn’ t meet this situation with the Lower version unity such as 2017.2.0f3.