I’m making a virtual Prompt and I’m attempting to put a cap on the amount of returns per keydown over time.
However, no mater what it seems that it will only activate the clause once every 5 seconds with the time clause no matter the settings of the variables.
public float returnRate = 0.005F;
public float nextFire = 0.005F;
public float time = 0.0f;
void OnGUI()
{
curTime = Time.time;
if(Event.current.keyCode == KeyCode.Return curTime > nextFire)
{
print ("Time: " + Time.time + " NextFire: " + nextFire);
nextFire=Time.time+returnRate;
textAreaString = textAreaString + "\n" + inputText;
inputText = ">";
}
}
}
However, if " curTime > nextFire) is commented out, the function activates 4 times every key press.
Ideally I’d need to to allow a return every one second.