Страницы

суббота, 13 мая 2017 г.

Unity's player setting Logging: ScriptOnly vs Full. What does it mean?

As said in docs, Full enables output of native stack traces in addition to managed once.
Example:


private void Awake()
{
    Application.logMessageReceivedThreaded += OnLogMessageReceivedThreaded;
}

public void TestAssertCallStack() // called from Start()
{
        Assert.raiseExceptions = false;
        Assert.IsFalse(true);
}

private void OnLogMessageReceivedThreaded(string condition, string stacktrace, LogType type)
{
        if (type != LogType.Assert)
        {
            return;
        }
        UiLogger.Trace(
            string.Format(
                "OnLogMessageReceived\ncondition: {0}\nstacktrace:\n{1}\ntype: {2}",
                condition,
                stacktrace,
                type
            ));
}

Output with ScriptOnly:


OnLogMessageReceived
condition: Assertion failed. Value was True
Expected: False
stacktrace:
UnityEngine.Assertions.Assert:IsFalse(Boolean)
Game.Impl.Sheets.CrashSheet:TestAssertCallStack() (at Assets/Game/Impl/Sheets/CrashSheet.cs:153)
DeepTest.Components.MainOnScene:Start() (at Assets/Game/InternalApi/MainOnScene.cs:14)

type: Assert

Output with Full:



OnLogMessageReceived
condition: Assertion failed. Value was True
Expected: False
stacktrace:
0x000000014151284B (Unity) StackWalker::GetCurrentCallstack
0x00000001415144FE (Unity) StackWalker::ShowCallstack
0x00000001414E5753 (Unity) GetStacktrace
0x00000001411E60EA (Unity) DebugStringToFile
0x00000001411E655C (Unity) DebugStringToFile
0x00000001411700D8 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000000001C4AC8DB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
0x000000001C4AC7C4 (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000000001C4AC155 (Mono JIT Code) [Logger.cs:42] UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x000000001C4AB996 (Mono JIT Code) [DebugBindings.gen.cs:207] UnityEngine.Debug:LogAssertion (object)
0x000000001C4AB694 (Mono JIT Code) [AssertBase.cs:30] UnityEngine.Assertions.Assert:Fail (string,string)
0x000000001C4AAC5B (Mono JIT Code) [AssertBool.cs:32] UnityEngine.Assertions.Assert:IsFalse (bool,string)
0x000000001C4AAB39 (Mono JIT Code) [AssertBool.cs:25] UnityEngine.Assertions.Assert:IsFalse (bool)
0x000000001C4AAA67 (Mono JIT Code) [CrashSheet.cs:153] Game.Impl.Sheets.CrashSheet:TestAssertCallStack ()
0x000000001C4A66B7 (Mono JIT Code) [MainOnScene.cs:14] DeepTest.Components.MainOnScene:Start ()
0x000000000A6E7132 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FF9C9CC54A3 (mono) [mini.c:4937] mono_jit_runtime_invoke
0x00007FF9C9C183F1 (mono) [object.c:2623] mono_runtime_invoke
0x0000000141202F3F (Unity) scripting_method_invoke
0x0000000140E33B85 (Unity) ScriptingInvocation::Invoke
0x0000000141207D81 (Unity) MonoBehaviour::InvokeMethodOrCoroutineChecked
0x0000000141207E92 (Unity) MonoBehaviour::InvokeMethodOrCoroutineChecked
0x0000000141208D27 (Unity) MonoBehaviour::Start
0x00000001412092B9 (Unity) MonoBehaviour::DelayedStartCall
0x000000014094A6C5 (Unity) DelayedCallManager::Update
0x0000000140BC0FB2 (Unity) PlayerLoop
0x0000000141486322 (Unity) Application::UpdateScene
0x00000001414867CB (Unity) Application::EnterPlayMode
0x000000014148F794 (Unity) Application::SetIsPlaying
0x0000000141490286 (Unity) Application::TickTimer
0x0000000141551A0E (Unity) FindMonoBinaryToUse
0x0000000141553031 (Unity) WinMain
0x000000014186E3FC (Unity) strnlen
0x00007FF9E9908102 (KERNEL32) BaseThreadInitThunk
0x00007FF9EC3AC5B4 (ntdll) RtlUserThreadStart

type: Assert

As you see, Debug.LogAssertion which is called internally in the example above is very much affected by this setting. Surprisingly, setting does not affect Debug.LogException calls. Tested in Unity 5.5.1f1 editor

Комментариев нет:

Отправить комментарий