Unity 2022.3.21
Seems
Environment.SetEnvironmentVariable ( "UNITY_EXT_LOGGING", "1" );
Environment.SetEnvironmentVariable ( "UNITY_EXT_LOGGING", "1", EnvironmentVariableTarget.Process );
Environment.SetEnvironmentVariable ( "UNITY_EXT_LOGGING", "1", EnvironmentVariableTarget.User );
have no effect
Are you setting the environment variable before launching the process? It needs to be set on startup. You can also launch the player with the “-timestamps” command line argument.
mdrunk
March 10, 2026, 5:32pm
3
use this:
public static class DebugTimestamps
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Init()
{
Debug.unityLogger.logHandler = new TimestampLogHandler(Debug.unityLogger.logHandler);
}
class TimestampLogHandler : ILogHandler
{
ILogHandler _default;
public TimestampLogHandler(ILogHandler def) => _default = def;
public void LogFormat(LogType type, UnityEngine.Object context, string format, params object[] args)
{
_default.LogFormat(type, context, $"[{System.DateTime.Now:MM/dd/yy HH:mm:ss.fff}] {format}", args);
}
public void LogException(System.Exception exception, UnityEngine.Object context)
{
_default.LogException(exception, context);
}
}
}