【Unity】Consoleのログにファイルへのリンクを埋め込む
TL;DR;
Debug.Log($@"<a href=""{filePath}"" line=""{line}"">link</a>");
Debug.Log($@"<a href=""{filePath}"" line=""{line}"">link</a>");
ConsoleWindow以外で
UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal
で即時開くことができます。
Button等で蹴ってあげればいいでしょう。
また、ConsoleWindowと同じようにAタグによってリンクを張ることもできます。ただし、GUIStyleをCN Message
にしておく必要があります。
static Lazy<GUIStyle> STYLE = new Lazy<GUIStyle>(() => (GUIStyle)"CN Message");
EditorGUILayout.SelectableLabel($@"<a href=""{filePath}"" line=""{line}"">link</a>", STYLE.Value);
Sample project
参考
Author And Source
この問題について(【Unity】Consoleのログにファイルへのリンクを埋め込む), 我々は、より多くの情報をここで見つけました https://qiita.com/up-hash/items/fca30e7e45089ba41537著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .