internal void SetupConfigs() { VRCModLogger.Log("[ModConfigPage] SetupConfigs"); VRCModLogger.Log("[ModConfigPage] Layer: " + scrollContent.gameObject.layer); //clear content //foreach (Transform child in scrollContent) Destroy(child); //foreach elements registered in ModPrefs, add a config element float totalHeight = 0; Dictionary <string, Dictionary <string, ModPrefs.PrefDesc> > modPrefs = ModPrefs.GetPrefs(); for (int i = 0; i < modPrefs.Count; i++) { bool categoryCreated = false; KeyValuePair <string, Dictionary <string, ModPrefs.PrefDesc> > modPrefCategory = modPrefs.ElementAt(i); foreach (KeyValuePair <string, ModPrefs.PrefDesc> pref in modPrefCategory.Value) { if (!pref.Value.Hidden) { //create a new category if (!categoryCreated) { categoryCreated = !categoryCreated; CreateCategoryTitle(ModPrefs.GetCategoryDisplayName(modPrefCategory.Key), ref totalHeight); } //add all prefs under this category CreatePref(pref.Value, ref totalHeight); } } } scrollContent.GetComponent <RectTransform>().sizeDelta = new Vector2(scrollContent.GetComponent <RectTransform>().sizeDelta.x, totalHeight > 800 ? totalHeight : 800); // 1000 -> 800 }