in JetBrains.Profiler.UnityApi/src/UnityProfiler.cs [23:51]
public void StartProfiling()
{
if (myProfiler == null)
myProfiler = new UnityProfilerInterop(myBinDirectory);
else if (myProfiler.IsProfilerCreated() != 0)
{
StopProfiling();
// Note(kzmn): ???
Thread.Sleep(1000);
myProfiler = new UnityProfilerInterop(myBinDirectory);
}
var errorMessage = IntPtr.Zero;
myProfiler.StartProfiling(ref errorMessage);
if (errorMessage == IntPtr.Zero)
return;
try
{
throw new ApplicationException(Marshal.PtrToStringAnsi(errorMessage));
}
finally
{
myProfiler.ReleaseString(errorMessage);
StopProfiling();
}
}