How to get debug info in the Unity3D editor

Is there a way to display a textual gizmo on all objects with a specific component without resorting to rendering to textures?

I'd like to display some debug info in the editor over each object as they interact with each other and swap data.

I've tried Handles.Label but I can only get it to display info on the selected object and I don't know how to get the container they show in the reference manual.

Comments

  • not sure if its still supported in the current ver. of unity but you can use GUIText (https://docs.unity3d.com/ScriptReference/GUIText.html).
  • You could do this with Gizmos.. but usually it's way to much effort for simple debug purposes. Maybe make a second material with the color overlay changed? (If you're using the standard shader)

    Another thing you could try is adding a world space Canvas to your object. Then it's easy to print debug info to that.
  • edited
    The suggestions above are good. You probably need to write your own custom Editor script for this, most likely using TextMesh as @AngryMoose suggested.

    I just have questions below for some clarity, maybe I'm just missing something.
    Fengol said:
    I'd like to display some debug info in the editor over each object as they interact with each other and swap data.
    How much info do you want to display here?
    Fengol said:
    I've tried Handles.Label but I can only get it to display info on the selected object and I don't know how to get the container they show in the reference manual.
    Do you have some code for this test, or elaborate a bit, I don't think I understand.
Sign In or Register to comment.