diff --git a/Source/Editor/Viewport/MainEditorGizmoViewport.cs b/Source/Editor/Viewport/MainEditorGizmoViewport.cs
index 68667b16f..0c759c950 100644
--- a/Source/Editor/Viewport/MainEditorGizmoViewport.cs
+++ b/Source/Editor/Viewport/MainEditorGizmoViewport.cs
@@ -450,6 +450,12 @@ namespace FlaxEditor.Viewport
///
public void DrawEditorPrimitives(GPUContext context, ref RenderContext renderContext, GPUTexture target, GPUTexture targetDepth)
{
+ // Draw gizmos
+ for (int i = 0; i < Gizmos.Count; i++)
+ {
+ Gizmos[i].Draw(ref renderContext);
+ }
+
// Draw selected objects debug shapes and visuals
if (DrawDebugDraw && (renderContext.View.Flags & ViewFlags.DebugDraw) == ViewFlags.DebugDraw)
{
@@ -463,12 +469,6 @@ namespace FlaxEditor.Viewport
DebugDraw.Draw(ref renderContext, target.View(), targetDepth.View(), true);
}
-
- // Draw gizmos
- for (int i = 0; i < Gizmos.Count; i++)
- {
- Gizmos[i].Draw(ref renderContext);
- }
}
private void OnPostRender(GPUContext context, RenderContext renderContext)
diff --git a/Source/Editor/Viewport/PrefabWindowViewport.cs b/Source/Editor/Viewport/PrefabWindowViewport.cs
index df3057203..4e71677b2 100644
--- a/Source/Editor/Viewport/PrefabWindowViewport.cs
+++ b/Source/Editor/Viewport/PrefabWindowViewport.cs
@@ -865,13 +865,13 @@ namespace FlaxEditor.Viewport
///
public override void DrawEditorPrimitives(GPUContext context, ref RenderContext renderContext, GPUTexture target, GPUTexture targetDepth)
{
- base.DrawEditorPrimitives(context, ref renderContext, target, targetDepth);
-
// Draw gizmos
for (int i = 0; i < Gizmos.Count; i++)
{
Gizmos[i].Draw(ref renderContext);
}
+
+ base.DrawEditorPrimitives(context, ref renderContext, target, targetDepth);
}
///
diff --git a/Source/Engine/Level/Actors/PointLight.cpp b/Source/Engine/Level/Actors/PointLight.cpp
index 5f9d4bdb3..9341002c1 100644
--- a/Source/Engine/Level/Actors/PointLight.cpp
+++ b/Source/Engine/Level/Actors/PointLight.cpp
@@ -136,8 +136,11 @@ void PointLight::Draw(RenderContext& renderContext)
void PointLight::OnDebugDraw()
{
- // Draw source tube
- DEBUG_DRAW_WIRE_TUBE(GetPosition(), GetOrientation(), SourceRadius, SourceLength, Color::Orange, 0, true);
+ if (SourceRadius > ZeroTolerance || SourceLength > ZeroTolerance)
+ {
+ // Draw source tube
+ DEBUG_DRAW_WIRE_TUBE(GetPosition(), GetOrientation(), SourceRadius, SourceLength, Color::Orange, 0, true);
+ }
// Base
LightWithShadow::OnDebugDraw();
diff --git a/Source/Engine/Level/Actors/SpotLight.cpp b/Source/Engine/Level/Actors/SpotLight.cpp
index c601506c4..ec25ffb5b 100644
--- a/Source/Engine/Level/Actors/SpotLight.cpp
+++ b/Source/Engine/Level/Actors/SpotLight.cpp
@@ -184,8 +184,11 @@ void SpotLight::Draw(RenderContext& renderContext)
void SpotLight::OnDebugDraw()
{
- // Draw source tube
- DEBUG_DRAW_WIRE_SPHERE(BoundingSphere(GetPosition(), SourceRadius), Color::Orange, 0, true);
+ if (SourceRadius > ZeroTolerance)
+ {
+ // Draw source tube
+ DEBUG_DRAW_WIRE_SPHERE(BoundingSphere(GetPosition(), SourceRadius), Color::Orange, 0, true);
+ }
// Base
LightWithShadow::OnDebugDraw();