Hunger and thirst bar help?

Basically i have this simple script i made that holds data for hunger and thirst and im trying to make the values increment slower then i have them. I have hungerSpeed set at 0.1 one tenth. I want something more along the lines of 0.01 but when i change my value i see no difference it still increments at 0.1?

using UnityEngine;
using System.Collections;

public class HudGUI : MonoBehaviour {

	public int _W = Screen.width;
	public int _H = Screen.height;
	public int maxHealth = 150;
	public int currentHealth = 150;
	public int maxHunger = 150;
	public float currentHunger = 0f;
	public float hungerSpeed = .1f;
	public int maxThirst = 150;
	public float currentThirst = 0f;
	public float thirstSpeed = .1f;
	public int maxSickness = 150;
	public int currentSickness = 0;
	

	void OnGUI () {
		GUI.Box(new Rect(_W - 150, _H - 100, 150, 100), "");

		GUI.Label (new Rect (_W - 140, _H - 90, 100, 30), "Health");
		GUI.Label (new Rect (_W - 50, _H - 90, 100, 30), currentHealth.ToString());
		GUI.Label (new Rect (_W - 140, _H - 70, 100, 30), "Hunger");
		GUI.Label (new Rect (_W - 50, _H - 70, 100, 30), currentHunger.ToString("0"));
		GUI.Label (new Rect (_W - 140, _H - 50, 100, 30), "Thirst");
		GUI.Label (new Rect (_W - 50, _H - 50, 100, 30), currentThirst.ToString("0"));
		GUI.Label (new Rect (_W - 140, _H - 30, 100, 30), "Sickness");
		GUI.Label (new Rect (_W - 50, _H - 30, 100, 30), currentSickness.ToString());
	}

	void Update() {

		currentHunger += Time.deltaTime * hungerSpeed;
		currentThirst += Time.deltaTime * thirstSpeed;

	
	}

}

I had the same problem with stamina regeneration and then tried it that way:

public float curHunger;
public float hungerRate = 10f;
private float nextHunger;

 private void Hunger()
    	{
    		if (Time.time > nextHunger) 
    		{
    			nextHunger = Time.time + hungerRate;
    			AdjustHunger(1);
    		}
    	}


public void AdjustHunger (float)
{
	curHunger += adj;
	
	hungerBarLength = (screenWidth * .2f) * (curHunger / maxHunger);
}

This way you can change the hungerRate to the value you want and it works perfectly :slight_smile: