Search code examples
machine-learningreinforcement-learningdeep-learning

Is there a way to import custom Reinforcement Learning Models into Unity?


Unity provides two RL algorithms to train agents: PPO and SAC.

I have been searching for weeks now on how to write my own algorithms and only found a mention of a gym-unity wrapper that wraps Unity Environments and I could just write my algorithms using Gym. This wrapper has 0 useful documentation so I don't have anywhere to start.

My questions are: (1) How can I import custom-written RL models into unity? (2) Is there a better documentation for the wrapper?


Solution

  • You could look at my repository genetic-unity that implements evolutionary algorithms using the ML-Agent package.

    I did not use their implemented agents (PPO and SAC) and I just used the interface between Unity and python to code my own algorithms, which is what you're looking for if I understand correctly.

    You could start by looking at the genetic_algorithm.py file to see how I handle the Unity environment.

    However you should note that this work was made 9 months ago and the ML-Agent framework changes at a fast pace, maybe you will need to adapt a little bit.