Version: 2022.3
언어: 한국어

Application.logMessageReceivedThreaded

매뉴얼로 전환

설명

Event that is fired if a log message is received.

This event will be triggered regardless of whether the message comes in on the main thread or not. This means that the handler code has to be thread-safe. It may be invoked from different threads and may be invoked in parallel. Make sure to only access Unity APIs from your handlers that are allowed to be called from threads other than the main thread.

Note: It is not necessary to subscribe to both Application.logMessageReceived and Application.logMessageReceivedThreaded. The multi-threaded variant will also be called for messages on the main thread.

See Also: Application.logMessageReceived.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public string output = ""; public string stack = "";

void OnEnable() { Application.logMessageReceivedThreaded += HandleLog; }

void OnDisable() { Application.logMessageReceivedThreaded -= HandleLog; }

void HandleLog(string logString, string stackTrace, LogType type) { output = logString; stack = stackTrace; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961