Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Time in coroutines

Discussion in '2D' started by DrDress, Sep 12, 2019.

  1. DrDress

    DrDress

    Joined:
    Sep 11, 2019
    Posts:
    30
    Hi

    I'm trying to do some simulation. The creatures in the simulation all have an infinit loop in a coroutine. The yield condition is that the coroutine waits about 0.1 sec with a little random variation, it then executes various functions and loops back to the yield again.

    Can I use the Time.deltaTime in my coroutine and assume that it knows how long since the last time it was in this coroutine or does Time.deltaTime only works with respect to frames passing?