A simple NaN solution - though likely not the most elegant

Here is my solution. I thought it would be best if the cycling stopped if period was set to 0 as I feel this is the closest behavior to what I believe the intent of a 0 period is.

        float cycles;
        if (period == 0)
        {
            cycles = 0;
        }
        else
        {
            cycles = Time.time / period; // grows continually from 0
        }
2 Likes

Privacy & Terms