diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index ed8d6c360..88b0a33a3 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -202,8 +202,11 @@ void CActor::DrawTouchBounds() { if (m_debugHovered || m_debugSelected) { auto aabox = GetTouchBounds(); if (aabox) { - m_actorDebugRender.setAABB(*aabox); - m_actorDebugRender.draw(m_debugAddColor); + if (!m_actorDebugRender) { + m_actorDebugRender = CAABoxShader(); + } + m_actorDebugRender->setAABB(*aabox); + m_actorDebugRender->draw(m_debugAddColor); } } } diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 7fdd2ea42..4da11a0ba 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -86,7 +86,7 @@ protected: void RenderInternal(const CStateManager& mgr) const; bool IsModelOpaque(const CStateManager& mgr) const; - CAABoxShader m_actorDebugRender; + std::optional m_actorDebugRender; public: enum class EFluidState { EnteredFluid, InFluid, LeftFluid };