public void Initialize() { weatherItems = new List <GameObject>(); ForecastType[] weathers = WeatherQueue.GetWeatherArray(); GameObject newGo; for (int i = 0; i < weathers.Length; i++) { switch (weathers[i]) { case ForecastType.Water: newGo = Instantiate(rainWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup); break; case ForecastType.Sun: newGo = Instantiate(sunWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup); break; case ForecastType.Lightning: newGo = Instantiate(lightningWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup); break; default: newGo = Instantiate(noWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup); break; } newGo.SetActive(true); weatherItems.Add(newGo); } // Debug.Log("Initialized Weather Queue Panel"); }
private void Awake() { if (instance != null) { GameObject.DestroyImmediate(instance.gameObject); Debug.LogError("additional weatherqueue found. deleting the older one"); } instance = this; // Debug.Log("defined instance"); }