private void Awake() { if (instance == null) { instance = this; newStuffToAdd = new Queue <int>(); //Debug.Log("Loaded loading bar!"); gameObject.SetActive(false); } else { GameObject.Destroy(this); } }
IEnumerator UpdateMorphs() { //slowly update all character morphs. List <Slider> sliderList = tree.GetCompleteSliderList(); Debug.Log("Loading Morphs from File. Slider Count: " + sliderList.Count.ToString()); PublicLoadingBar.AddNewStuff(sliderList.Count, 10); if (!busy) { busy = true; int count = 0; for (int i = 0; i < sliderList.Count; i++) { Type sliderType = sliderList[i].sliderValue.GetType(); if (sliderType == typeof(float) || sliderType == typeof(int)) { if (M3DHandler.UpdateSliderCheck(sliderList[i].sliderID, Convert.ToSingle(sliderList[i].sliderValue))) { count++; } } if (count > batchSize) { count = 0;// reset the count for the next iteration. yield return(null); } PublicLoadingBar.UpdateProgress(1); //can also check for things like "colours" and stuff like that, once we get more complicated. } Debug.Log("Successfully loaded morphs from file."); //m3DHandler.RecalculateBounds(); busy = false; } }