public void OnSettingsUI(UIHelperBase helper) { UIHelperBase group = helper.AddGroup("Shadow Distance Fix"); group.AddSlider("Shadow Distance", 6000, 40000, 1000f, SDPSettings.maxDistance, sel => { var sdf = UnityEngine.Object.FindObjectOfType <CameraController>(); // Null check - for e.g. access from main menu options before game has loaded. if (sdf != null) { sdf.m_maxShadowDistance = sel; } // Update and save settings. SDPSettings.maxDistance = sel; SDPSettings.SaveSettings(); }); group.AddDropdown("minShadowDistance", OptionLabels, SDPSettings.minDistance, sel => { var sdfmin = UnityEngine.Object.FindObjectOfType <CameraController>(); // Null check - for e.g. access from main menu options before game has loaded. if (sdfmin != null) { sdfmin.m_minShadowDistance = OptionValues[sel]; } // Update and save settings. SDPSettings.minDistance = sel; SDPSettings.SaveSettings(); }); }
/// <summary> /// Called by the game when the mod is enabled. /// </summary> public void OnEnabled() { // Load the settings file. SDPSettings.LoadSettings(); }