Changing a value over time
I am trying to change a value when entering a trigger, the code works fine however the issue is that the value is changing too quickly. Is there a way to slow it down?
function OnTriggerStay (trigger_red : Collider)
{
if (player_damage_range == true)
{
player_hp -= Time.deltaTime * 1;
hp_value_player= player_hp.ToString();
}
}
Thanks
Comment
Best Answer
Answer by giantSwing · Nov 15, 2016 at 04:26 PM
Well you're multiplying it by 1, just multiply it something smaller, like 0.5f or 0.3f etc
I've tried changing the value but no number no matter how small seems to work.
Is the player health a float or an int? if its an int change it to float
Yep changing it to a float has worked, thank you very much.
Your answer
![](https://koobas.hobune.stream/wayback/20220612100733im_/https://answers.unity.com/themes/thub/images/avi.jpg)