- Home /
How to properly handle file and line opening from console with custom Assert
Hi guys,
I want to have custom assert functions for multiple reasons (like stripping them in release builds). To do that, I have custom methods to wrap calls to Unity Assert like that:
public class DebugCustom
{
static void Assert(bool condition)
{
Debug.Assert(condition);
}
}
Obviously this works. The problem is the Unity console: when I encounter an assert and double click on it from the Unity console, it will always open the DebugCustom.cs file in VS/MonoDevelop instead of the file and line where I actually call DebugCustom.Assert. It opens the file one step to low in the callstack.
I tried couple of stuff, like raising an Exception in my custom Assert method instead of calling Unity's Assert function, but it doesn't solve the issue.
Is there a way to tell the Unity console to jump to another file/line when double-clicking an assert or a log? I know there is, in some other language, an additional integer parameter you can specify when calling Assert function to tell the depth of the callback you are interested in. But I can't find similar features in C#/Unity.
Thanks