I am trying to create a health bar that is controlled by a script attached to the player. I made the slider with the new UI system and is in the scene. I also have a variable called
public Slider healthSlider
When I try to drag the slider into the healthSlider field, It does not stay and, therefore, I cant control the slider as it is never referenced. Is there a way to control the slider with a c# script attached to a prefab(player)?