void InitCamera() { if (playerCamera != null) { GameObject healthBar = Instantiate(Resources.Load("HealthBar", typeof(GameObject))) as GameObject; playerCamera.AddUIElement(healthBar); playerStats.healthSlider = healthBar.GetComponentInChildren <Slider>(); } }