Hello everyone.
I have been working with Unreal Engine 4 and thus with PhysX 3.3 since last year. After the PhysX source was made available through UE4 I’ve really wanted to work inside PhysX and atm I’m trying to get the Visual Studio debugger to step through the PhysX code that’s running inside UE4.
build and run the UE4 Editor with a debug configuration
open PhysX.sln with Visual Studio
attach the VS debugger to UE4
set breakpoints and step through PhysX code
The problem is that the debugger is very erratic because UE4 is attaching to the release build (PhysX3PROFILE_x64.dll) instead of the debug build (PhysX3DEBUG_x64.dll) of PhysX. Despite building UE4 with its “Debug Editor” configuration.
Both dll files inside:
This is a UE4 integration with PhysX issue and I posted on the UE4 AnswerHub: https://answers.unrealengine.com/questions/235415/how-to-debug-physx.html with no luck.
So I’m here asking if anyone here has encountered this issue and if you would like to share your solution.
I’m hoping there is a clean logical solution and that I won’t have to hack and slash UE4’s build configuration to fix this.
You can compile UE4 with all third party libs in debug. In BuildConfiguration.cs just set
bDebugBuildsActuallyUseDebugCRT = true;
and recompile.
You can also compile with just physx in debug by modifying GetPhysXLibraryMode in PhysXBuild.cs. You will then need to make sure that the dlls also load with debug versions. This is done in LoadPhysXModules in PhysXLibs.cpp. The code should automatically load the correct dlls but if you get a crash it is likely that it has loaded profile dlls instead of the debug ones. It is straightforward to change the code to fix this.
With these changes you should be able to run in Development Editor config and have physx running in debug.
Hello,
You’ve written about modifying GetPhysXLibraryMode in PhysXBuild.cs and that “With these changes you should be able to run in Development Editor config and have physx running in debug.”
Unfortunately i’m getting “error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MDd_DynamicDebug’ doesn’t match value ‘MD_DynamicRelease’” while linking with such configuration and was wandering if anybody has any solution for this since i’m interested in only running PhysX in debug.