简体   繁体   中英

How to attach Visual Studio to Unity in order to debug a native dll?

I have a native dll which is used by a project in Unity 2019.4.35f1. Since the logic in the dll is complicated I would like to be able to debug it.

From the main answer here
https://answers.unity.com/questions/30620/how-to-debug-c-dll-code.html
I was able to log debug from inside the dll.

From the answer from this thread by Tomas1856, a Unity Technologies superuser, I get that the only way to really debug the native dll code line by line is to attach a debugger to the executable.
https://forum.unity.com/threads/how-to-step-into-a-native-c-dll-in-visual-studio.413387/

The problem is that I am not able to. I have the dll Visual Studio 2019 project. It is build in debug mode. It's pdb file is here. I have tried changing many project settings from advices I have read on the inte.net including on stackoverflow. But still when I press the play button in Unity and press the Attach to Process in Visual Studio the breakpoints I have put in the dll code all turn white with an error message "The breakpoint will not be hit. No symbols have been loaded for this document".
I am attaching to the Unity.exe process. I have tried changing the output path for the dll and the pdb.

I am pretty sure I am missing something obvious.
Can someone provide any guidance, please?

After a month I have accidently found the reason. Error Pause was activated. I have logged an error so the Game has paused which makes it impossible to attach to the Unity process. I hope this helps anyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM