# Frequently Asked Questions ## Scripting Runtime Environment not setup correctly If you haven't switched your scripting runtime version from .NET 3.5 to .NET 4.6 or .NET 4.x, you will see such error message: ```console error CS1061: Type `System.Text.StringBuilder' does not contain a definition for `Clear' and no extension method `Clear' of type `System.Text.StringBuilder' could be found. Are you missing an assembly reference? ``` This is because .NET 3.5 doesn't support method Clear() for StringBuilder, refer to [Setting Up The ML-Agents Toolkit Within Unity](Installation.md#setting-up-ml-agent-within-unity) for solution. ## TensorFlowSharp flag not turned on If you have already imported the TensorFlowSharp plugin, but haven't set ENABLE_TENSORFLOW flag for your scripting define symbols, you will see the following error message: ```console You need to install and enable the TensorFlowSharp plugin in order to use the Learning Brain. ``` This error message occurs because the TensorFlowSharp plugin won't be usage without the ENABLE_TENSORFLOW flag, refer to [Setting Up The ML-Agents Toolkit Within Unity](Installation.md#setting-up-ml-agent-within-unity) for solution. ## Instance of CoreBrainInternal couldn't be created If you try to use ML-Agents in Unity versions 2017.1 - 2017.3, you might encounter an error that looks like this: ```console Instance of CoreBrainInternal couldn't be created. The the script class needs to derive from ScriptableObject. UnityEngine.ScriptableObject:CreateInstance(String) ``` You can fix the error by removing `CoreBrain` from CoreBrainInternal.cs:16, clicking on your Brain Gameobject to let the scene recompile all the changed C# scripts, then adding the `CoreBrain` back. Make sure your brain is in Internal mode, your TensorFlowSharp plugin is imported and the ENABLE_TENSORFLOW flag is set. This fix is only valid locally and unstable. ## Environment Permission Error If you directly import your Unity environment without building it in the editor, you might need to give it additional permissions to execute it. If you receive such a permission error on macOS, run: ```sh chmod -R 755 *.app ``` or on Linux: ```sh chmod -R 755 *.x86_64 ``` On Windows, you can find [instructions](https://technet.microsoft.com/en-us/library/cc754344(v=ws.11).aspx). ## Environment Connection Timeout If you are able to launch the environment from `UnityEnvironment` but then receive a timeout error like this: ``` UnityAgentsException: The Communicator was unable to connect. Please make sure the External process is ready to accept communication with Unity. ``` There may be a number of possible causes: * _Cause_: There may be no LearningBrain with `Control` option checked in the `Broadcast Hub` of the Academy. In this case, the environment will not attempt to communicate with python. _Solution_: Click `Add New` in your Academy's `Broadcast Hub`, and drag your LearningBrain asset into the `Brains` field, and check the `Control` toggle. Also you need to assign this LearningBrain asset to all of the Agents you wish to do training on. * _Cause_: On OSX, the firewall may be preventing communication with the environment. _Solution_: Add the built environment binary to the list of exceptions on the firewall by following [instructions](https://support.apple.com/en-us/HT201642). * _Cause_: An error happened in the Unity Environment preventing communication. _Solution_: Look into the [log files](https://docs.unity3d.com/Manual/LogFiles.html) generated by the Unity Environment to figure what error happened. # _Cause_: You have assigned HTTP_PROXY and HTTPS_PROXY values in your environment variables. _Solution_: Remove these values and try again. ## Communication port {} still in use If you receive an exception `"Couldn't launch new environment because communication port {} is still in use. "`, you can change the worker number in the Python script when calling ```python UnityEnvironment(file_name=filename, worker_id=X) ``` ## Mean reward : nan If you receive a message `Mean reward : nan` when attempting to train a model using PPO, this is due to the episodes of the Learning Environment not terminating. In order to address this, set `Max Steps` for either the Academy or Agents within the Scene Inspector to a value greater than 0. Alternatively, it is possible to manually set `done` conditions for episodes from within scripts for custom episode-terminating events. ## Problems with training on AWS Please refer to [Training on Amazon Web Service FAQ](Training-on-Amazon-Web-Service.md#faq)