Unity 로그 콜백을 VSTU와 공유Share the Unity log callback with VSTU
Visual Studio Tools for Unity는 콘솔을 Visual Studio에 스트림할 수 있도록 로그 콜백을 Unity로 등록합니다.Visual Studio Tools for Unity registers a log callback with Unity to be able to stream its console to Visual Studio. 편집기 스크립트가 로그 콜백을 Unity로 등록하는 경우에도 VSTU 콜백이 사용자의 콜백과 충돌할 수 있습니다.If your editor scripts also register a log callback with Unity, the VSTU callback might interfere with your callback. 이러한 가능성을 방지하려면 VisualStudioIntegration.LogCallback
이벤트를 사용하여 VSTU와 상호 운용해야 합니다.To prevent this possibility, use the VisualStudioIntegration.LogCallback
event to cooperate with VSTU.
데모Demonstrates
Visual Studio Tools for Unity에서 만든 Unity 로그 콜백을 공유하는 방법How to share the Unity Log Callback created by Visual Studio Tools for Unity.
예제Example
#if ENABLE_VSTU
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class LogCallbackHook
{
static LogCallbackHook()
{
VisualStudioIntegration.LogCallback += (string condition, string trace, LogType type) =>
{
// place code that implements your log callback here
};
}
}
#endif