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.

Question Ml-agents, How to reset environment?

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

  1. Unity_538

    Unity_538

    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. Unity_538

    Unity_538

    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. Unity_538

    Unity_538

    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. Unity_538

    Unity_538

    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,524
    In the "OnEpisodeBegin" override.....you reset everything to go back to the initial state.