Search Unity

How to catch log messages in build

Discussion in 'Editor & General Support' started by VS-Productions, Nov 21, 2019.

  1. VS-Productions

    VS-Productions

    Joined:
    Feb 19, 2017
    Posts:
    7
    Hello everybody,

    I'm working on a game/simulation that teaches people how to make games in Unity. For that I parse log messages to help the player understand the console.

    Following code is used to catch all log messages:

    Code (CSharp):
    1. void OnEnable() => Application.logMessageReceived += LogCallback;
    2. LogCallback(string condition, string stackTrace, LogType type) => DoStuff();
    In the editor everything works fine but in different builds I encounter following problems:

    Non-Development Build + ScriptOnly Stacktrace in PlayerSettings:
    No Log messages at all (besides exceptions).

    Non-Development Build + Full Stacktrace in PlayerSettings:
    All log messages but the stacktrace is not understandable for beginners.

    Development Build + ScriptOnly Stacktrace in PlayerSettings:
    All log messages like in the editor (desired goal) BUT Development Build watermark in the corner.

    Now following question: is there a possibility to
    1. remove the watermark in a development build somehow or
    2. catch the same log messages in a normal build like working in the editor?


    To code my own log-writer is not really an option because the player is working with a runtime-C#-compiler and can basically code everything like he was in the Unity Editor.

    Thanks in advance!
     
    Last edited: Nov 22, 2019
    _eternal likes this.