Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Ml-agents, How to reset environment?

Discussion in 'ML-Agents' started by Kittisakrr, Mar 14, 2023.

  1. Kittisakrr

    Kittisakrr

    Joined:
    Feb 9, 2021
    Posts:
    8
    I use Ml-agents to train my agents. But I have my doubts about my surroundings. My environment can be destroyed, but when the Endepisode doesn't reset the environment. I want to reset my environment every time at Endepisode, how do I do that? I'm very confused now.
     
  2. Kittisakrr

    Kittisakrr

    Joined:
    Feb 9, 2021
    Posts:
    8
    I have many environments in the scene.
     
  3. seifmostafa7347

    seifmostafa7347

    Joined:
    Nov 2, 2021
    Posts:
    22
    Can you elaborate on your question?
    i mean the environment is reset either when the Steps for each agent are greater than the max step specified, or if you call the function EndEpisode() from your agent
    either way, it call OnEpisodebegin callback, which you should override to implement your own environment randomizations
     
  4. Kittisakrr

    Kittisakrr

    Joined:
    Feb 9, 2021
    Posts:
    8
    In my environment, there is a car.
    In the environment, There are roads that break if a car is stepped on, and with Endepisode, I want the roads to go back to normal. What do I have to do?

    Suppose I want to load the environment every time an endepisode or step completes.
     
  5. Kittisakrr

    Kittisakrr

    Joined:
    Feb 9, 2021
    Posts:
    8
    Help me pls
     
  6. seifmostafa7347

    seifmostafa7347

    Joined:
    Nov 2, 2021
    Posts:
    22
    I didn't clearly understand your explanation of the problem not gonna lie, but I believe it's more of a unity question, not magnets one.
    If you are looking for the callbacks that get triggered on epsidoebegin and so .. check out unityml agents' documentation
    https://unity-technologies.github.io/ml-agents/ML-Agents-Toolkit-Documentation/
    otherwise, I think you need to grasp an understanding of unity basics itself
     
  7. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    In the "OnEpisodeBegin" override.....you reset everything to go back to the initial state.