UnitySetGraphics not called in native plugin

I am trying to run the sample native plugin from Unity - Manual: Low-level native plug-in interface in Windows x86, but Unity is not calling my UnitySetGraphics or UnityRenderEvent functions. I have tried changing the method signature to __UnitySetGraphicsDevice__ and __UnityRenderEvent__ but nothing changed.

I checked whether the functions were called by setting breakpoints in Visual Studio and attaching the debugger to Unity. SetTimeFromUnity is being called every frame.

I am using Visual Studio 2013, building x86.

Here is the dll in Dependancy Walker:

Notice no name mangling.

Edit: Tried Visual Studio 2008 with no success.

I’ve run into this problem twice now and this appears to have been what fixed it for me:

  1. Close Unity
  2. Delete \Library\metadata\
  3. Delete everything in \Assets\Plugins\ and then place your .dll in it
  4. Restart Unity and let it reload the metadata