Search Unity

Question Using Windows PerformanceCounter with Unity

Discussion in 'Editor & General Support' started by Leyren, May 25, 2023.

  1. Leyren

    Leyren

    Joined:
    Mar 23, 2016
    Posts:
    29
    Hello :)

    I can't figure out how to use the PerformanceCounter of System.Diagnostics with Unity. I installed the package via NuGetForUnity (https://github.com/GlitchEnzo/NuGetForUnity)
    upload_2023-5-25_8-54-8.png

    which worked flawlessly. The dependency is also correctly recognized in VS. But when I use the script in my scene, I get "PlatformNotSupportedException: Performance Counters are not supported on this platform."
    upload_2023-5-25_8-55-47.png
    Code:
    upload_2023-5-25_8-56-35.png
    I know Performance Counters are Windows only. I'm using Windows 10.

    What am I missing?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,727
    Parts of
    System.Diagnostics
    are definitely not implemented in IL2CPP. This comes up most often with people trying to use
    Process
    , which is AFAIK not implemented and there are no plans to implement it, at least from what I recall reading, I think from a Unity person.