Can't add script behaviour VisualContainerAsset",Can't Add Script "The script needs to derive from ,Im getting the Cant add script behavior VisualContainerAsset. the script needs to drive from MonoBehaviour
I don't know whats wrong can someone help
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Playerhealth : MonoBehaviour { public int maxHealth; public Text currentHealthLabel; private int currenthealth;
// Use this for initialization
void Start ()
{
currenthealth = maxHealth;
UpdateGUI();
}
// Update is called once per frame
void UpdateGUI()
{
currentHealthLabel.text = currenthealth.ToString();
}
public void AlterHealth(int amount)
{
currenthealth += amount;
currenthealth = Mathf.Clamp(currentHealth, 0, maxHealth);
UpdateGUI();
}
} ,I don't know whats wrong can someone figure this out using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Playerhealth : MonoBehaviour { public int maxHealth; public Text currentHealthLabel; private int currenthealth;
// Use this for initialization
void Start ()
{
currenthealth = maxHealth;
UpdateGUI();
}
// Update is called once per frame
void UpdateGUI()
{
currentHealthLabel.text = currenthealth.ToString();
}
public void AlterHealth(int amount)
{
currenthealth += amount;
currenthealth = Mathf.Clamp(currentHealth, 0, maxHealth);
UpdateGUI();
}
}
Your answer
Follow this Question
Related Questions
How to damage player when bullet collides with player. 0 Answers
How to regenerate player's health after timer countdown is done. 1 Answer
Why is my player not getting more damaged? 0 Answers
Referencing playerHealth (from a separate script) in an if statement 1 Answer
Health is not lowering right? 0 Answers