Skip to content

Commit 8371b96

Browse files
committed
[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
1 parent d37bfb6 commit 8371b96

File tree

1 file changed

+2
-3
lines changed
  • unity-environment/Assets/ML-Agents/Scripts

1 file changed

+2
-3
lines changed

unity-environment/Assets/ML-Agents/Scripts/Agent.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@ public abstract class Agent : MonoBehaviour
257257
void OnEnable()
258258
{
259259
textureArray = new Texture2D[agentParameters.agentCameras.Count];
260-
for (int i = 0; i < brain.brainParameters.cameraResolutions.Length; i++)
260+
for (int i = 0; i < agentParameters.agentCameras.Count; i++)
261261
{
262-
textureArray[i] = new Texture2D(brain.brainParameters.cameraResolutions[i].width,
263-
brain.brainParameters.cameraResolutions[i].height, TextureFormat.RGB24, false);
262+
textureArray[i] = new Texture2D(1, 1, TextureFormat.RGB24, false);
264263
}
265264
id = gameObject.GetInstanceID();
266265
Academy academy = Object.FindObjectOfType<Academy>() as Academy;

0 commit comments

Comments
 (0)