zz74b
1
I am making a call to Application.RegisterLogCallback in the OnEnable() method of my MonoBehaviour derived class.
However the callback is never called, regardless of the number of Debug.Log() messages I output (and that get written to the console).
I’ve tried:
- RegisterLogCallback in the Awake, Update and OnGUI methods
- Ensuring that the class is not being destroyed
- Wrapping the callback method in a (redundant)
new Application.LogCallback (callback)
- Praying
This is in the Windows Editor, running on Windows 7
Does anyone have any pointers on how to get the registration working?
Thanks
Update:
The callback IS being called for exceptions thrown within the application, but not for Debug.Log, LogWarning or LogError.
zz74b
2
It turns out that I needed to use the poorly documented RegisterLogCallbackThreaded() function instead. In my situation I was registering on the main thread, but the Debug.Log messages were being called from a background thread.
The documentation states: “The only difference between this function and RegisterLogCallback is that this function gets called from a different thread.”
What they really mean: “Use this function when the calls to Debug.Log will be made from a different thread”