From 0f819a3af496e536b84bfdd4e628e1f3b9f35bfa Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Mon, 12 May 2025 11:56:26 +0100 Subject: [PATCH] Update EditorGui.ed.tscript clean teardown around editorPluginSet not sure why this is failing at the foreach but editorPluginSet doesnt seem to exist during the teardown of everything and foreach causes a null reference to be fired off. --- .../worldEditor/scripts/EditorGui.ed.tscript | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript index 714e81b80..87ec21497 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript @@ -317,8 +317,11 @@ function EditorGui::shutdown( %this ) %this.setEditor( "" ); // Call the shutdown callback on the editor plugins. - foreach( %plugin in EditorPluginSet ) - %plugin.onWorldEditorShutdown(); + for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ ) + { + %obj = EditorPluginSet.getObject(%i); + %obj.onWorldEditorShutdown(); + } } /// This is used to add an editor to the Editors menu which @@ -575,9 +578,11 @@ function EditorGui::onWake( %this ) EHWorldEditor.setStateOn( 1 ); // Notify the editor plugins that the editor has started. - - foreach( %plugin in EditorPluginSet ) - %plugin.onEditorWake(); + for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ ) + { + %obj = EditorPluginSet.getObject( %i ); + %obj.onEditorWake(); + } // Push the ActionMaps in the order that we want to have them // before activating an editor plugin, so that if the plugin @@ -616,9 +621,11 @@ function EditorGui::onSleep( %this ) MoveMap.pop(); // Notify the editor plugins that the editor will be closing. - - foreach( %plugin in EditorPluginSet ) - %plugin.onEditorSleep(); + for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ ) + { + %obj = EditorPluginSet.getObject(%i); + %obj.onEditorSleep(); + } if(isObject($Server::CurrentScene)) $Server::CurrentScene.open(); @@ -715,8 +722,12 @@ function EditorGui::onNewLevelLoaded( %this, %levelName ) function EditorMissionCleanup::onRemove( %this ) { EditorGui.levelName = ""; - foreach( %plugin in EditorPluginSet ) - %plugin.onExitMission(); + + for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ ) + { + %obj = EditorPluginSet.getObject(%i); + %obj.onExitMission(); + } } //-----------------------------------------------------------------------------