一般项目都会封装自己的log输出,以便自己能统一对输出log进行处理。但是遇到的问题就是双击过后会调到自己的封装代码中,不会指定到想要的位置。
在网上找有好多的类似的教程,通过生成dll,通过反射,前者更改起来很费事,我就只做了后者。但是在反射的时候遇到
m_CurrentEntriesPtr != NULL && m_IsGettingEntries
原因是指针没有找到,只要在反射的时候顺便取到StartGettingEntries和EndGettingEntries两个方法
,在GetEntryInternal调用的前后调用即可。
protected static EditorWindow loglistviewobj;
private static object listview;
private static object logentryobj;
private static MethodInfo LogEntriesGetEntry;
private static MethodInfo startlogentresget;
private static MethodInfo endlogentresget;
private static FieldInfo entrycontent;
private static FieldInfo rowfieldinfo;
private const string MyCsName = "CExtends";
static bool ishasconsolewindow()
{
if (listview == null)
{
Assembly editorassembly = Assembly.GetAssembly(typeof(EditorWindow));
Type consolewindowtype = editorassembly.GetType("UnityEditor.ConsoleWindow");
FieldInfo mConsol