From a6038d1801ad702f48065f4cd039767a52dd23e1 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 16:59:43 -0600 Subject: [PATCH] Fixes issue with not detecting any non-template level meshes in the choose level dlg screen. --- .../game/data/ui/scripts/chooseLevelDlg.cs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs index e04077f83..af260c27d 100644 --- a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs +++ b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs @@ -32,26 +32,16 @@ function ChooseLevelDlg::onWake( %this ) %this->LevelDescription.visible = false; %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "LevelAsset")) - return; //if we didn't find ANY, just exit + AssetDatabase.findAssetType(%assetQuery, "LevelAsset"); %count = %assetQuery.getCount(); - if(%count == 0) + if(%count == 0 && !IsDirectory("tools")) { //We have no levels found. Prompt the user to open the editor to the default level if the tools are present - if(IsDirectory("tools")) - { - MessageBoxYesNo("Error", "No levels were found in any modules. Do you want to load the editor and start a new level?", - "EditorOpenMission();", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - } - else - { - MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - } - + MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", + "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); + %assetQuery.delete(); return; }