public void Awake() { //Only do this once... if (ModeMismatchChecked) { return; } ModeMismatchChecked = true; WBIPlayModeHelper helper = new WBIPlayModeHelper(); //If we have a config file, then get the current mode. helper.GetModes(); string playModeName = helper.GetPlayModeFromFile(); int index = helper.GetPlayModeIndex(playModeName); if (index == -1) { //No config file so let's see if CRP is installed. string playModeFile = KSPUtil.ApplicationRootPath.Replace("\\", "/") + "GameData/CommunityResourcePack/CRP.version"; //If the file exists then find the CRP play mode if (System.IO.File.Exists(playModeFile)) { index = helper.GetPlayModeIndex("CRP"); if (index == -1) { return; } } } //Now auto-detect the current mode. int autoDetectIndex = helper.AutodetectMode(); if (autoDetectIndex == -1) { return; } //If the modes don't match then make sure we're using the correct templates. //This will ensure that we can distribute mods with Classic Stock as the default mode //but not break players' saves. if (index != autoDetectIndex) { Debug.Log("[WBIModeChecker] - Play Mode mismatch detected, setting correct templates."); helper.SetPlayMode(index); } }