I tried to capture the log output using Application.RegisterLogCallback but it did not work:
int logcalled ;
// Use this for initialization
void OnEnable() {
UnityEngine.Application.RegisterLogCallback(new Application.LogCallback(MyCallback));
}
private void MyCallback(string condition, string stacktrace, UnityEngine.LogType type)
{
logcalled++;
}
void OnGUI(){
GUI.Label(new Rect(10,10,100,100), logcalled.ToString());
if(GUI.Button(new Rect(100,100,100,100),"press"))
{
Debug.LogError("iada iada");
Debug.Log("iada iada 2");
object a = null;
a.ToString();
}
}
The above code dont work, the variable logcalled not incremented.
- Tried Debug.Log, Debug.LogError and a even a null exception, neither was captured, but they where all logged to the editor console.
- Tried to register the callback on "Start" with the same results.
- Tried a Debug.Log on the "Update" method, generating dozens of log msg/second. In this case 'logcalled' was called 2 times at the very begining and that was it.
- Tried using javascript instead of C#, didnt work either.
Am I missing something?
(question was edited to clarify it)