explaingit

unity-technologies/ml-agents

19,400C#Audience · researcherComplexity · 4/5Setup · hard

TLDR

An open-source toolkit that lets you use Unity game environments as training grounds for AI, teaching agents to make decisions through reinforcement learning without writing explicit rules.

Mindmap

mindmap
  root((repo))
    What It Does
      Trains AI agents
      Reinforcement learning
      Imitation learning
      Multi-agent scenarios
    Tech Stack
      Unity C#
      Python
      PyTorch
      PPO and SAC
    Use Cases
      NPC behavior
      Game auto-testing
      Robotics research
      Custom RL research
    Audience
      Game developers
      AI researchers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Train NPCs in a Unity game to navigate levels and avoid obstacles using reinforcement learning

USE CASE 2

Teach game characters to mimic human playthroughs using imitation learning from recorded examples

USE CASE 3

Run multi-agent simulations with cooperative or competitive AI teams inside a Unity scene

USE CASE 4

Use the Python API to plug in a custom RL algorithm and train it against a Unity environment

Tech stack

C#UnityPythonPyTorch

Getting it running

Difficulty · hard Time to first run · 1h+

Requires both Unity Editor and a Python environment with PyTorch, versions must match the ML-Agents release exactly or training will fail.

In plain English

Unity ML-Agents is an open-source toolkit that lets you use Unity game environments, the same engine used to build video games, as training grounds for teaching AI to make decisions. The core idea is reinforcement learning: instead of programming explicit rules for how an agent (a character, robot, or object) should behave, you let the AI figure out the best actions by trying things out and receiving rewards for success. Unity's 3D, 2D, and VR/AR environments make rich and varied training scenarios easy to set up. The toolkit has two main parts: a C# SDK that you integrate into your Unity scene to define what agents can observe and do, and a Python training library (built on PyTorch) that runs the learning algorithms outside the game. Game developers can use it to control NPCs (non-player characters) with learned behavior or to automatically test their game before release. Researchers can plug in their own algorithms via a Python API. Supported algorithms include PPO and SAC (popular deep reinforcement learning methods) and two imitation learning approaches that let agents learn by watching examples rather than trial and error. Multi-agent scenarios, cooperative teams or competitive opponents, are also supported. You would use ML-Agents when you want to train intelligent behavior in a simulated environment, whether for a game, robotics research, or AI experimentation. The tech stack is Unity (C#) for environments and Python/PyTorch for training.

Copy-paste prompts

Prompt 1
Set up Unity ML-Agents in a new Unity project, create a simple rolling ball agent, and train it with PPO to reach a target
Prompt 2
Show me how to define observations and actions for a custom ML-Agents agent in C# so it can learn to jump over obstacles
Prompt 3
How do I use ML-Agents imitation learning to train an agent by recording my own Unity gameplay?
Prompt 4
Write a Python training script that connects to a Unity ML-Agents environment and runs 500,000 training steps with SAC
Prompt 5
How do I set up a multi-agent competitive scenario in Unity ML-Agents where two agents compete to score goals?
Open on GitHub → Explain another repo

← unity-technologies on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.