I’ve written a script for restoring health and it works on the player in the prefab folder but not with the player in the gaming area
code as it is:
public PlayerHealth playerHealth;
public Slider healthSlider;
public int HealthUp = 10;
void OnTriggerEnter(Collider col)
{
if (col.tag == "Player")
{
playerHealth.currentHealth += HealthUp; // x = pHc + 10
healthSlider.value += playerHealth.currentHealth; //x = hS + pHc
Debug.Log ("Stage 1; Health restored");
gameObject.SetActive(false);
Debug.Log ("stage 2: Health pick gone");
}
}
The references are all correct, the pickup disappears but no health restore. Any suggestions?