Draw XXL documentation


enum DrawBasics.usedUnityLineDrawingMethod

Unity offers differnt ways of drawing lines. Each way has its advantages, disadvantages and use cases. With this "usedUnityLineDrawingMethod" setting you can configure which of Unitys draw-a-line-methods Draw XXL uses under the hood.

The default method is "debugLines" in the Editor, which falls back to "wireMesh" in builds.
If you want to draw in Edit mode you can consider using "gizmoLines" or "debugLinesInPlayMode_gizmoLinesInEditModeAndPlaymodePauses".
Using "disabled" is an easy global toggle to switch of everything that Draw XXL draws.

Method Name Description
debugLines
  • Can be used from everywhere in code. It is not tied to MonoBehaviours.
  • Is limited to Playmode. Doesn't work properly in Editmode or during Playmode pauses.
  • Doesn't work in builds. In builds Draw XXL will fall back from this "debugLines" to "wireMesh".
  • Supports the duration parameter and the hideable/depthTest parameter.
  • The lines are only visible if the "gizmo" button in the top right corner of the Scene view/Game view window is switched on.
gizmoLines
  • Works in Edit mode and Play mode.
  • Is tied to GameObjects and works only from inside Unitys OnDrawGizmos*() functions.
  • Easy way for "draw only if the GameObject is selected" via OnDrawGizmosSelected()
  • Doesn't support the duration parameter and the hideable/depthTest parameter.
  • Works only if the component whose "OnDrawGizmos*()" is used is expanded in the Editor Inspector.
  • Similarly to using Gizmo.DrawLine() where the user has the responsibility to ensure that it is only called from within OnDrawGizmos*() it is also in DrawXXL with the "gizmoLines" setting: The user has to care for placing calls of Draw XXL draw functions only within the two OnDrawGizmos functions.
  • When drawing gizmo lines via Draw XXL then Unitys own gizmo color setting is ignored and instead the color that is specified in the Draw XXL function call or DrawBasics.defaultColor is used. Though Unitys gizmo matrix setting is taken into account by the Draw XXL functions.
  • Doesn't work in builds. In builds Draw XXL will fall back from this "gizmoLines" to "wireMesh".
  • The lines are only visible if the "gizmo" button in the top right corner of the Scene view/Game view window is switched on.
debugLinesInPlayMode_gizmoLinesInEditModeAndPlaymodePauses This is an attempt to comibine the advantages of the "debugLines" and the "gizmoLines" setting. If you have Draw XXL API calls spread among your project, say some for drawing in Play mode in "Update()" and some for drawing in Edit mode in "OnDrawGizmos", then always before the Draw operation itself you first would have to instruct Draw XXL with the "usedUnityLineDrawingMethod" setting whether to use debugLines or gizmoLines. But we can make use of some assumptions to simplfy this process. There is no harm in drawing the lines from "OnDrawGizmos" with "debugLines" when inside Play mode. So in Play mode "debugLines" can always be used. On the other side: Update() is anyway not called in Edit mode and only OnDrawGizmos() is left to be called, so in Edit mode all draw operations can be done with "gizmoLines".

Below the line this means: You can put your Draw XXL calls anywhere - OnDrawGizmos and Update or else - but don't have to always think about the correct setting of "usedUnityLineDrawingMethod".
It doesn't work though if you activated the execution of "Update()" outside playmode with "[ExecuteInEditMode]" or "MonoBehaviour.runInEditMode" or something similar, because then Unity will complain that gizmo lines are drawn outside of OnDrawGizmos().

In builds Draw XXL will fall back from this setting to "wireMesh".
handlesLines
  • Use this setting if you want to use the Draw XXL functions to supplement your custom handles inside OnSceneGUI(), see also HandlesExamples
  • Draw with this setting only from inside OnSceneGUI() and there only in the Repaint event.
  • Doesn't support the duration parameter and the hideable/depthTest parameter.
  • When drawing handles lines via Draw XXL then Unitys own handles color setting is ignored and instead the color that is specified in the Draw XXL function call or DrawBasics.defaultColor is used. Though Unitys handles matrix setting is taken into account by the Draw XXL functions.
  • Handles lines are never visible in the Game View, only in the Scene View, even if you activate gizmos for the Game View window.
wireMesh
  • Drawing with a mesh is Draw XXLs choice when it comes to drawing in builds. All other draw methods (except "disabled") fall back to mesh in builds.
  • Is not intended for drawing in Edit mode.
  • Supports the duration parameter and the hideable/depthTest parameter. Hidden lines are fully hidden and don't shimmer through as when "debugLines" is used.
  • Can be anti aliased depending on your projects/cameras fullscreen image effect settings.
  • Some project/camera fullscreen image effect settings can swallow the lines so that they aren't readable well anymore.
  • The lines are also visible if the "gizmo" button in the top right corner of the Scene view/Game view window is switched off.
disabled Setting "usedUnityLineDrawingMethod" to "disabled" is an easy switch to disable all of Draw XXLs drawing without having to clean up all draw operation lines from the code. It works in the Editor an in builds. Only a minimum performance overhead remains for the called draw functions that don't do anything anymore.