void Update() { while (Time.time - lastFunctionSwitch >= functionDuration) { lastFunctionSwitch += functionDuration; functionName = FunctionLibrary.GetNext(functionName); } UpdateFunction(); }