Profile game with Visual Studio

Hello,

I’m trying to run instrumentation profiler on my Unity build to know which functions are called the most and take the most time.

I have created librairies in C# which are imported in Unity, I can debug them without problems but am not able to start the visual studio profiler to instrument them.

I couldn’t find an instrumentation function in Unity over a session. Or at least it seems to crash and I get many exceptions after a few minutes of running. (ThreadDeserializer should not parse more data once it has been marked as terminated)

I have tried:

  • attach VS to Unity play mode but the instrumentation option isn’t active
  • build in Unity with Debug options, PDB copied, deep profiling enabled, when trying to profile the .exe from Visual Studio I get

Unable to obtain debugging information. PRF0002: The instrumentation with those options has failed

  • I also try to run my application .exe and attach VS’s debugger but the instrumentation option is available.

Am I missing something?

Thank you for your help!

To test performance in Unity you can simply use the profiler and even make extensions for the profiler to use for more clarity within functions