From 09f7c6103d0149ea9508ff94ea903025e409ac4a Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 9 May 2025 22:18:23 +0800 Subject: [PATCH] Update RuntimeComponentsDrawer.cs --- src/Internal/Editor/RuntimeComponentsDrawer.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Internal/Editor/RuntimeComponentsDrawer.cs b/src/Internal/Editor/RuntimeComponentsDrawer.cs index 5d01276..8a2e318 100644 --- a/src/Internal/Editor/RuntimeComponentsDrawer.cs +++ b/src/Internal/Editor/RuntimeComponentsDrawer.cs @@ -247,12 +247,17 @@ namespace DCFApixels.DragonECS.Unity.Editors.X } _runtimeComponentsDepth++; - _drawers[_runtimeComponentsDepth].DrawRuntimeComponents(entityID, world, isWithFoldout); - - _runtimeComponentsDepth--; - if (_runtimeComponentsDepth < RuntimeComponentsDepthRoot) + try { - _runtimeComponentsDepth = RuntimeComponentsDepthRoot; + _drawers[_runtimeComponentsDepth].DrawRuntimeComponents(entityID, world, isWithFoldout); + } + finally + { + _runtimeComponentsDepth--; + if (_runtimeComponentsDepth < RuntimeComponentsDepthRoot) + { + _runtimeComponentsDepth = RuntimeComponentsDepthRoot; + } } } private void DrawRuntimeComponents(int entityID, EcsWorld world, bool isWithFoldout)