I have made a health hud using a slider but I get the error:
Assets/Scripts/PlayerScripts/PlayerHealth.js(3,17): BCE0018: The name ‘Slider’ does not denote a valid type (‘not found’). Did you mean ‘UnityEngine.UI.Slider’?
my script:
var Health = 100;
var player : GameObject;
var healthBar : Slider;
function ApplyDammage1 (TheDammage : int)
{
Health -= TheDammage;
healthBar.value = Health;
if(Health <= 0)
{
Dead();
}
}
function Start()
{
healthBar = Slider;
}
function Dead()
{
Destroy (player);
Application.LoadLevel(3);
}
var Health = 100;
var player : GameObject;
var healthBar : UnityEngine.UI.Slider;
function ApplyDammage1 (TheDammage : int)
{
Health -= TheDammage;
healthBar.value = Health;
if(Health <= 0)
{
Dead();
}
}
function Dead()
{
Destroy (player);
Application.LoadLevel(3);
}
but now I’ve got the error ’ NullReferenceException: Object reference not set to an instance of an object ’