Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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:
    107
    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?