Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

More control over Debug.Log but maintain connection to caller

Discussion in 'Scripting' started by JeffersonTD, Nov 22, 2015.

  1. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    I'm in the beginning of a new project, and I want to add a simple system to allow more control over what gets logged. The problem is that if I use a separate method for doing the Debug calls (such as Debug.LogWarning()) clicking on the logged row in console doesn't lead me to the place where the contents of the row are defined but the helper method instead. How could I change this?
     
  2. btft

    btft

    Joined:
    Aug 11, 2015
    Posts:
    14
    You can't.
    You can however use thing called Call Stack in your IDE or in script editor.
    Last call on stack will be call from your debug.log manager.
    Second call on stack will be from class that called manager for this.
     
  3. JeffersonTD

    JeffersonTD

    Joined:
    Feb 5, 2013
    Posts:
    267
    Thanks for the comment. Not sure what you meant by mentioning the call stack though. I mean you do see the whole stack normally, the matter is just what's on top of it. In any case I did some googling and actually found a way to do this. Just needed to put the stuff in a separate assembly.