playMaker

Author Topic: Get Console log action but for Unity errors  (Read 2211 times)

mrminico

  • Full Member
  • ***
  • Posts: 129
Get Console log action but for Unity errors
« on: January 12, 2023, 04:48:40 AM »
Does anyone know of an action that can get unity Console logs and save it into a string?

Example: there's an error on Unity's end I'll be able to get the log and plug it into a string to see it in-game. 

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Get Console log action but for Unity errors
« Reply #1 on: January 12, 2023, 11:31:17 AM »
Hi.
I did a quick search and with C# script it seems not to be possible.
If its not possible in C# then it will also not be possible with an action :)

if you overlooked and it is possible in C#, then post a link :)

mrminico

  • Full Member
  • ***
  • Posts: 129
Re: Get Console log action but for Unity errors
« Reply #2 on: January 27, 2023, 05:47:31 PM »
I actually found a way to do it. A combination of both Scripts and Playmaker

public class DebugLog : MonoBehaviour
{
    public string log;

    private void Start()
    {
        log = "";
        Application.logMessageReceived += HandleLog;
    }

    private void HandleLog(string logString, string stackTrace, LogType type)
    {
        log += logString + "\n";
    }
}


And then I used Get Property Action set the Target Object to Debug Script and Property to Log. I then stored the string and set the UI to show me the results.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Get Console log action but for Unity errors
« Reply #3 on: January 28, 2023, 10:06:32 AM »
Hi.
Oh nice!

Does it work in a build?

mrminico

  • Full Member
  • ***
  • Posts: 129
Re: Get Console log action but for Unity errors
« Reply #4 on: January 30, 2023, 02:59:42 PM »
Yes, it worked on the build and displayed the console information through the string I stored.