Search Unity

Hide Method in Stack Trace Log

Discussion in 'Scripting' started by TommySKD, Jun 9, 2018.

  1. TommySKD

    TommySKD

    Joined:
    Jul 23, 2014
    Posts:
    25
    Hello, so I have a function like this for debugging:

    Code (CSharp):
    1.     private void MyLog(object o)
    2.     {
    3.         Debug.Log(o);// inside MyLog
    4.         Console.Log(o);
    5.     }
    Console is just an ingame console so I can see Debug.Log(...) outside of editor.

    Problem: if I call for example: MyLog("Hello"); and double click on it in unity editor Console window it is gonna point me to this line of code:
    Debug.Log(o);// inside MyLog
    I'd like it to ignore that stack trace and point me to the MyLog("hello"); line in code instead.

    Is that possible somehow?
     
    v01pe_ likes this.
  2. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    TommySKD likes this.
  3. hk1ll3r

    hk1ll3r

    Joined:
    Sep 13, 2018
    Posts:
    88
    If the helper method is in a .dll without source, then console would ignore those. So you could create a dummy binary that had just that helper method. import the .dll under your plugins folder and then double clicking in the console would ignore your helper and open the calling method. Exactly what the OP wants.

    Would be nice to create an attribute one could add to their methods they wanted excluded from stack trace. The console window would show those lines in black and not links. It should be straightforward to implement. Unity, please!
     
    Eristen, freso, Seromu and 11 others like this.