Search Unity

Question How to get a stable timer ?

Discussion in 'ML-Agents' started by Delt4a, Jan 12, 2023.

  1. Delt4a

    Delt4a

    Joined:
    Jan 23, 2020
    Posts:
    2
    Hey, I am beginning to experience with MLAgents, and I am trying to do something where if the Agent don't reach a target in an amount of time (countdown timer), I call EndEpisode() and give a negative reward.

    I saw this https://forum.unity.com/threads/tim...r-update-in-order-to-get-stable-timer.920456/

    But even while doing it in FixedUpdate and with a --time-scale=1 I can see that my timer isn't stable, and even the whole game is going faster than at the same scale without MLAgents?
     
  2. smallg2023

    smallg2023

    Joined:
    Sep 2, 2018
    Posts:
    147
    Time.fixedDeltaTime for FixedUpdate, it records how long since the last FixedUpdate was called and should return the same time if the game loop is able to run optimally, I can't see why you would have any issues adding a timer with it - how are you coding your timer?