Intro
There are strong parallels between robots and characters in a game. In fact, in many ways, one can view a non-playable character (NPC) as a virtual robot, with its own observations about the environment, its own set of actions and a specific objective. Thus it is natural to explore how we can train behaviors within Unity using reinforcement learning. This is precisely what the ML-Agents Toolkit offers.
Resources
- Unity- ML-Agents Overview
- https://github.com/Unity-Technologies/ml-agents
- CLI + MCP + AI IDE (ChatGPT Codex/Cursor/Antigravity/Claude Code/Windsurf): Next Steps for Unity Workflow Automation
Unity ML-Agents Toolkit
The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning. https://github.com/Unity-Technologies/ml-agents
Setup
https://docs.unity3d.com/Packages/com.unity.ml-agents@4.0/manual/Installation.html
Environment Setup
- Create a Conda environment
conda create -n mlagents python=3.10.12 && conda activate mlagentsInstall ML-Agents (Advanced)
- Clone repo
git clone --branch release_23 https://github.com/Unity-Technologies/ml-agents.git- Open the repo’s
Projectfolder in Unity - Install the ML-Agents Unity package by adding the
com.unity.ml-agentspackage - Install the ML-Agents Python package (with Conda env)
# cd /path/to/ml-agents
python -m pip install ./ml-agents-envs
python -m pip install ./ml-agents- Verify installation
mlagents-learn --helpOpen Example Environment
https://docs.unity3d.com/Packages/com.unity.ml-agents@4.0/manual/Examples-setup.html
- Open
Assets/ML-Agents/Examplesto access an example (e.g. 3D ball example workflow )



