- Home /
Is there any way to get Debug.DrawLine() to display in the game view without other gizmos?
Hi
I have a (relatively small and totally work-aroundable) problem, but I'm just wondering if there's a simple check I can do to fix it...
I want the lines rendered by Debug.DrawLine() to appear in the Game view. Simple. Press the Gizmo button on the game view and they display...
The problem is that all the gizmos (mostly object setup related) I have then also render and get in the way of what I'm trying to see when I use Debug.DrawLine().
Is there any way to:
a) cause Debug.DrawLine to render in the game view without the Gizmo button turned on?
b) check which view (scene or game) is active so I can not render the gizmos in the game view?
cheers,
darbotron
Answer by StephanK · Sep 04, 2010 at 12:07 PM
You can check if you're running in the editor with Application.platform. I don't think you can turn on Debug.DrawLine separately, but you could draw your lines with another method that works in game.
Hadn't thought of Application.platform, but it's not really a lot of use TBH.
I don't really want to spend any unnecessary time messing with what would amount to implementing my own version of debug.drawline using LineRenderer or the GL rendering class unless I have to.
Thanks anyway.
Answer by Statement · Dec 15, 2010 at 05:40 PM
You can use LineRenderer to render lines. Then you can check Application.isEditor and only draw during that condition.
The editor doesn't really have any options for what you're trying to accomplish so it's going to have to be custom made.