How to get subscription time knitting x times per second

There is an Effects / Timing section in the knitting handbook for an example of a subscription return Time.every second

.

The documentation has only a few details millisecond

, second

, minute

etc.

Is there a way to get a subscription like 20 per second or some other subgranularity?

What is the best way to achieve something like this.

+3


source to share


1 answer


Time

is just an alias for Float

, so you can do numeric operations with it. If you want your subscription to fire 20 times per second, just make sure it fires every 1/20

second.



In other words: Time.every (second / 20.0)

+6


source







All Articles