Glossary term

Unity ML-Agents

What is Unity ML-Agents?

Unity Machine Learning Agents, known as ML-Agents, is Unity's open-source toolkit for training intelligent agents using machine learning. Developers build simulation environments where agents learn behaviors through techniques such as reinforcement learning, making the toolkit useful for NPC behavior, automated game testing, and robotics or real-time 3D simulations.

How does Unity ML-Agents work?

ML-Agents connects Unity environments with machine learning models, allowing agents to learn by interacting with simulated scenarios. Developers define an agent's observations, possible actions, and rewards, then train the agent to improve its behavior over repeated attempts.

The toolkit supports several training approaches, including reinforcement learning, where agents learn through rewards and penalties; imitation learning, where they learn from human or scripted demonstrations; and multi-agent training, where multiple agents learn to cooperate or compete.

Once training is complete, developers export the trained neural network as an ONNX model and integrate it back into their Unity project for real-time runtime inference.

Benefits of UnityML-Agents

  • Open source: Unity ML-Agents is available as an open-source project, giving developers access to its source code, documentation, example environments, and community resources.
  • Flexible training methods: Support for reinforcement learning, imitation learning, and multi-agent training lets teams choose the right approach for different agent behaviors within a single toolkit.
  • Built for Unity environments: ML-Agents works directly inside Unity, allowing developers to train agents in the same 2D, 3D, and immersive environments they use for production.
  • Deploy trained models across platforms: Models trained with ML-Agents can be embedded into Unity projects for runtime inference across supported desktop, mobile, console, and XR platforms.

How is Unity ML-Agents used?

Teams across game development, simulation, and academic research use Unity ML-Agents to train adaptive behaviors that would be difficult or time-consuming to program with traditional scripted rules.

In game production, common uses include training NPCs to react dynamically to players, automating gameplay and build testing, and evaluating level design by having agents repeatedly test mechanics before release. Outside of games, researchers and engineers use ML-Agents for industrial simulations, autonomous navigation, and robotics training inside safe virtual environments.

Frequently asked questions (FAQ)