Can I output the name of the current class and/or function?

Is there a way in Unity script to log the current execution context using Debug.Log()?

Just for example, here’s how it’s done in Objective-C:

NSLog(@"%s %d %s %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);

I’d like to know how to do it in JavaScript and C# (if it’s possible).

1 Answer

1

In C# you can use the StackTrace.