Abusing reflection and the internal Unity player build error function to get stacktrace-less error logs. Not recommended for anything sane.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Reflection; | |
public class TerriblyHackyLog : MonoBehaviour | |
{ | |
void Start () | |
{ | |
Log ("Aaaaarrrrgh!"); | |
} | |
static void Log (string message) | |
{ | |
typeof (Debug).GetMethod ( | |
"LogPlayerBuildError", | |
BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.NonPublic | |
).Invoke ( | |
null, | |
new object[]{message, "", 0, 0} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment