From 8371b96a38cb74163665e28752946ba4d2cd2f7e Mon Sep 17 00:00:00 2001 From: vincentpierre Date: Mon, 23 Jul 2018 16:40:27 -0700 Subject: [PATCH] [Hotfix] Removed the reference to the brain in the OnEnable method of the agent to avoid errors when the agent is initialized without a brain --- unity-environment/Assets/ML-Agents/Scripts/Agent.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/unity-environment/Assets/ML-Agents/Scripts/Agent.cs b/unity-environment/Assets/ML-Agents/Scripts/Agent.cs index 12226ab654..273a43b921 100755 --- a/unity-environment/Assets/ML-Agents/Scripts/Agent.cs +++ b/unity-environment/Assets/ML-Agents/Scripts/Agent.cs @@ -257,10 +257,9 @@ public abstract class Agent : MonoBehaviour void OnEnable() { textureArray = new Texture2D[agentParameters.agentCameras.Count]; - for (int i = 0; i < brain.brainParameters.cameraResolutions.Length; i++) + for (int i = 0; i < agentParameters.agentCameras.Count; i++) { - textureArray[i] = new Texture2D(brain.brainParameters.cameraResolutions[i].width, - brain.brainParameters.cameraResolutions[i].height, TextureFormat.RGB24, false); + textureArray[i] = new Texture2D(1, 1, TextureFormat.RGB24, false); } id = gameObject.GetInstanceID(); Academy academy = Object.FindObjectOfType() as Academy;