Unity Machine Learning Agents

Train and embed intelligent agents by leveraging state-of-the-art deep learning technology.

responsive and intelligent virtual players

Create an intelligent game experience

Creating responsive and intelligent virtual players and non-playable game characters is hard. Especially when the game is complex. To create intelligent behaviors, developers have had to resort to writing tons of code or using highly specialized tools.

With Unity Machine Learning Agents (ML-Agents), you are no longer “coding” emergent behaviors, but rather teaching intelligent agents to “learn” through a combination of deep reinforcement learning and imitation learning. Using ML-Agents allows developers to create more compelling gameplay and an enhanced game experience.

Complex AI environments

Create realistic and complex AI environments to train models

Advancement of artificial intelligence (AI) research depends on figuring out tough problems in existing environments using current benchmarks for training AI models. However, as these challenges are “solved,” the need for novel environments arises. But creating such environments is often time-intensive and requires specialized domain knowledge. 

Using Unity and the ML-Agents toolkit, you can create AI environments that are physically, visually, and cognitively rich. You can use them for benchmarking as well as researching new algorithms and methods.


How Unity ML-Agents works

Integrate ML Agents

Integrate the ML-Agents Unity package.

Train agents

Connect your integrated Unity project and start training the agents to learn the right behaviour. 

Puppo The Corgi

When training is complete, embed the trained agent model back into your Unity project.

Millions of natural-feeling, procedurally generated monsters

In Source of Madness, an action rogue-lite game created by Carry Castle, you traverse an ever-changing dynamic world, battling new procedurally generated monsters each playthrough, brought to life by a powerful machine-learning AI.

Creating the enemy monsters involved several challenges for the small team:

  • The physics controlling the monsters is unusual
  • There are millions of variations of monsters
  • The monsters needed to look natural
Source of Madness game art

Using the ML-Agents toolkit – and, specifically, deep reinforcement learning – the team trained and created a neural network model that produced the right behavior. Then, using the Unity Inference Engine, they embedded the model into the game.

Unity and Jamcity logos

Faster training times with JamCity Snoopy Pop

We partnered with JamCity to train an agent for their bubble shooter Snoopy Pop. One of the challenges with training an agent to play Snoopy Pop is the large volume of gameplay data to learn effective behaviors and strategies. Additionally, most games in development are constantly evolving, so training times need to be reasonably fast. We introduced various features in ML-Agents like Asynchronous Environments, Generative Adversarial Imitation Learning (GAIL), and Soft Actor-Critic to solve these problems.

Key benefits

Open source

The Unity ML-Agents toolkit is open source with an Apache 2.0 license. This allows you to modify and implement ML-Agents according to your needs.

AI/ML expertise not required

The toolkit has everything you need to get started, including ready-to-use state-of-the-art algorithms and robust documentation and example projects. You also get the support of a helpful gamedev community.

Easy setup with minimal coding

It’s quick and easy to set up your game as an AI training environment. You can create intelligent characters without a lot of coding.

Plenty of starter environments

Whether your project is a 2D game, continuous control system, or large game space, several starter environments are available to help you get started.

Cross-platform inference support

Using the Unity Inference Engine (Barracuda), you can deploy your ML-Agents models on any platform (PC, mobile or console) that is supported in Unity.

Extensible training of agents

Access to C#, communication protocol, and a low-level Python API that gives you the flexibility to try different algorithms and methods for training agents enriches your advanced AI and research use cases.

Scale up your training

Need to scale up your training?

An ML-Agents cloud offering will be available later this year that will enable ML-Agents users to train on a scalable cloud infrastructure. With this cloud offering you will be able to submit many concurrent training sessions or easily scale out a training session across many machines for faster results. 

If you are currently using ML-Agents and need help with scaling and managing experiments, sign up for a preview access.


ML-Agents Hummingbird Course

ML-Agents Hummingbird Course

Learn how to implement ML-Agents

We’ve partnered with Immersive Limit to create an online course that teaches you how to implement ML-Agents through exercises, code walkthroughs, and helpful discussions.

Tap the community

Ask questions, find answers, and connect with other Unity ML-Agents experts and experimenters, including Unity staff.

Support Issues

File support issues on our github page

Have an elaborate or complex scenario?

Contact us - ml-agents@unity3d.com

Explore our ecosystem

Check out Unity’s AI and machine learning products and learn how they can help you solve diverse problems.

Unity Computer Vision

Get perfectly labeled, high-quality data for computer vision training at a fraction of the cost.

Robotics Simulation

Prototype, test, and train your robots in high-fidelity, realistic simulations before deploying them to the real world.

Unity Simulation

Harness the power of cloud to run millions of simulations to generate training data for machine learning, test and validate AI algorithms, or evaluate and optimize modeled systems.

Train and embed intelligent agents

Use Unity ML-Agents and state-of-the-art deep learning technology to create complex AI environments and an intelligent game experience.

We use cookies to ensure that we give you the best experience on our website. Visit our cookie policy page for more information.

Got it