I'm using a raycast to determine if my player is in air or not
How can I check if my character is in air for 5 seconds before switching to another state
Add two new variables.
bool InAir;
float InAirTimer;
When you do the raycast, set InAir to true if you're in air, false if you're not. Then in update, do this:
if (inAir) { inAirTimer += Time.deltaTime; }
else { inAirTimer = 0; }
if (inAirTimer >= 5) { /* Here is where you do something */ }