Using Python to train works well, but it is not something a real game would ever use. Ideally, what we want to be able to do is build a TensorFlow graph and use it in Unity. Fortunately, a library was constructed, called TensorFlowSharp, that allows .NET to consume TensorFlow graphs. This allows us to build offline TFModels and later inject them into our game. Unfortunately, we can only use trained models and not train in this manner, at least not yet.
Let's see how this works by using the graph we just trained for the GridWorld environment and use it as an internal brain in Unity. Follow the exercise in the next section to set up and use an internal brain:
- Download the TFSharp plugin from this link: https://s3.amazonaws.com/unity-ml-agents/0.5/TFSharpPlugin.unitypackage.
If this link does not work, consult the Unity docs or the Asset Store for a new one...