How to modify Time value


following code issues an error

float TimeModifier = 5.0f;
Time EndTime = Time.time + TimeModifier;

“error CS0029: Cannot implicitly convert type float' to UnityEngine.Time’”

Also when trying to compare time another error is outputed: “error CS0019: Operator >' cannot be applied to operands of type float’ and `UnityEngine.Time’”

if (Time.time > EndTime) break;

It should look like this:

                float TimeModifier = 5.0f;
                float EndTime = Time.time + TimeModifier;

You wrote “Time EndTime” instead of “float EndTime”.
The compiler tries to convert the float resulting “Time.time + TimeModifier” to the class “Time” (which is just a static class containing all the time methods) thus the confusing error message.