I assume that maybe Unity is skipping over a few numbers and is missing the number that it is supposed to match. I have noticed that Time.time has like 5 numbers after the period so that could explain why. However I will ask first before trying to work around the problem. I was also think about maybe using clamp to say if(float == (any number inside the clamp)) but this probably wont work. I have other solutions that WILL work but I want to try using == Time.time first. Here’s some code to help you understand
var hpRayStall : float;
Update(){
if(Input.GetButtonDown("P2hp"))
{
hpRayStall = Time.time + 2;
}
if(hpRayStall == Time.time)
{
var hpRay = Physics.Raycast(lp.transform.position, transform.TransformDirection(Vector3.right), 2);
}
if(hpRay)
{
sceneManager.GetComponent(SceneManagerScript).p1HP -= 6;
}