Version: 2023.1

Logger.logEnabled

切换到手册
public bool logEnabled ;

描述

运行时切换调试记录 [ON/OFF]。

using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour { private static ILogger logger = Debug.unityLogger; private static string kTAG = "MyGameTag";

void Start() { logger.logEnabled = Debug.isDebugBuild;

logger.Log(kTAG, "This log will be displayed only in debug build"); } }