'Debug -> Windows -> Memory for a Unity project?
I need to inspect memory content for a Unity project while debugging it.
No matter what I try, such as Use managed compatibility mode, the Memory window desperately shows:
Unable to evaluate the expression.
Question:
Is it possible at all to inspect memory using the Memory window for a Unity project?
Solution 1:[1]
Debug -> Windows -> Memory for a Unity project?
Actually, in unity project,memory window cannot catch managed code automatically, you should use Watch Window to get the address of the variable and then input the address on Memory Window to get it.
Suggestion
First of all, please enable these options from this document.
1) set a breakpoint on the variable of Unity project and when the breakpoint be hit, you could open Watch Window, and use &
to get the address of variable like this:
2) Then copy the address in the Memory Window and you can see the memory content about it:
Besides, you could also try to use Unity Profiler just as Lotan recommended to watch the memory content.
Solution 2:[2]
Here is a trick which has let me see unmanaged memory which is used in managed code:
- attach one VS as Unity Debugger, pause, get variable address from Watch window;
- attach another VS as native debugger, pause, put address into a Memory window.
To interact with VS in Unity debugger mode just hit "Continue" in native debugger.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | user2745509 |