# Unity ml-agents integration

**URL:** <https://discuss.ray.io/t/unity-ml-agents-integration/2340>\
**Category:** RLlib\
**Created:** [May 31, 2021, 8:31am UTC](https://discuss.ray.io/t/unity-ml-agents-integration/2340 "2021-05-31T08:31:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattkmp](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@mattkmp](https://discuss.ray.io/u/mattkmp)\
**Post date:** [May 31, 2021, 8:31am UTC](https://discuss.ray.io/t/unity-ml-agents-integration/2340/1 "2021-05-31T08:31:27Z")

</div>

Hello,

I am in the process of developing a project where I want to set Unity3D as the external simulation environment and use RLlib for training a RL algorithm, following a client-server approach.

I have been able to export the tf model and convert it to .onnx format, but still I cannot manage to use it as the brain inside Unity in order to run inference with ML-agents. I suspect that the problem is that ML-agents expects a specific naming convention for input and output tensor names. Is there a way to set the model layer names inside RLlib with the desired conventions? Any other possible suggestions?

Thank you in advance,  
Matthew

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [June 1, 2021, 3:42pm UTC](https://discuss.ray.io/t/unity-ml-agents-integration/2340/2 "2021-06-01T15:42:36Z")

</div>

Hey @mattkmp , great question. I’m actually not sure either what the exact requirements are for importing ONNX models as an ML-Agents brain. Could you find out from the Unity side what these conditions are? If the layers require certain tf-names, you could write your own custom model based on our `ray.rllib.models.tf.fcnet.py::FullyConnectedNetwork` and have RLlib use that instead via:

```auto
config:
    model:
        custom_model: [your custom model class]

```
