Search Unity

What if there was a way to link debug log outputs and game objects in the scene?

Discussion in 'Editor & General Support' started by Arowx, Sep 7, 2020.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Often I use debug logs to work out problems in my code then end up adding debug scene objects to aid in the process.

    What If I could link a game object to a debug line (the same way code errors link to scripts but within the editor scene view) this could speed up the debug process.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    If you add a GameObject reference as a second parameter to Debug.Log, Unity will take you to that GameObject in the hierarchy. Like this:

    Code (CSharp):
    1. Debug.Log("message", myGameObject);
    So I think what you're asking about exists already?
     
  3. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Saved my day, btw wont work if you link a component, so we should not forget to access the game object through myComponent.gameObject
     
    watchagames likes this.