using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEditor;
/*
原文地址 https://zhuanlan.zhihu.com/p/92291084
*/
public static class OpenAssetLogLine
{
private static bool m_hasForceMono = false;
// 处理asset打开的callback函数
[UnityEditor.Callbacks.OnOpenAssetAttribute(-1)]
static bool OnOpenAsset(int instance, int line)
{
if (m_hasForceMono) return false;
using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using System.Reflection; using System.Text.RegularExpressions; using UnityEditor; /*
原文地址 https://zhuanlan.zhihu.com/p/92291084 */ public static class OpenAssetLogLine { private static bool m_hasForceMono = false; // 处理asset打开的callback函数 [UnityEditor.Callbacks.OnOpenAssetAttribute(-1)] static bool OnOpenAsset(int instance, int line) { if (m_hasForceMono) return false;
}
static string GetStackTrace() { // 找到类UnityEditor.ConsoleWindow var type_console_window = typeof(EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow"); // 找到UnityEditor.ConsoleWindow中的成员ms_ConsoleWindow var filedInfo = type_console_window.GetField("ms_ConsoleWindow", BindingFlags.Static | BindingFlags.NonPublic); // 获取ms_ConsoleWindow的值 var ConsoleWindowInstance = filedInfo.GetValue(null); if (ConsoleWindowInstance != null) { if ((object)EditorWindow.focusedWindow == ConsoleWindowInstance) { // 找到类UnityEditor.ConsoleWindow中的成员m_ActiveText filedInfo = type_console_window.GetField("m_ActiveText", BindingFlags.Instance | BindingFlags.NonPublic); string activeText = filedInfo.GetValue(ConsoleWindowInstance).ToString(); return activeText; } } return null; } }