Is it possible to get a proper reference to object that called our static method?
I call a static method from many places in Unity project and I'd like to pass a gameObject
to context in UnityEngine.Debug.Log(object message, Object context)
for easier debugging with Unity console. I already tried with System.Diagnostics.StackTrace
class and found nothing but strings which aren't useful.
edit: Here's a code similar to what i need to achieve:
public static class DebuggingHelper {
public static void LogText() {
var callingObject = SomeStaticReflectionClasss.INeedToGetItSomehowHere();
if(callingObject is UnityEngine.Object)
UnityEngine.Debug.Log("Good morning", callingObject as UnityEngine.Object)
}
}