Error when trying to run training/inference with duplicated environments

HI all,

I am getting this error when I try to duplicate DrivingArea3. The area has 4 agents, each with visual observations.


7434287--910877--upload_2021-8-20_18-4-24.png

NullReferenceException: Object reference not set to an instance of an object
Unity.MLAgents.Sensors.CameraSensor.ObservationToTexture (UnityEngine.Camera obsCamera, UnityEngine.Texture2D texture2D, System.Int32 width, System.Int32 height) (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Sensors/CameraSensor.cs:158)
Unity.MLAgents.Sensors.CameraSensor.GetCompressedObservation () (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Sensors/CameraSensor.cs:92)
Unity.MLAgents.Policies.HeuristicPolicy.StepSensors (System.Collections.Generic.List1[T] sensors) (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Policies/HeuristicPolicy.cs:137)__ __Unity.MLAgents.Policies.HeuristicPolicy.RequestDecision (Unity.MLAgents.AgentInfo info, System.Collections.Generic.List1[T] sensors) (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Policies/HeuristicPolicy.cs:38)
Unity.MLAgents.Agent.SendInfoToBrain () (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Agent.cs:1096)
Unity.MLAgents.Agent.SendInfo () (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Agent.cs:1323)
Unity.MLAgents.Academy.EnvironmentStep () (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Academy.cs:573)
Unity.MLAgents.AcademyFixedUpdateStepper.FixedUpdate () (at Library/PackageCache/com.unity.ml-agents@2.1.0-exp.1/Runtime/Academy.cs:43)

How do I solve this issue?

Ubuntu 18.04
mlagents 2.1.0
Unity 2020.3.11f1

Thanks in advance!

oops sorry, problem resolved. Somehow an extra blank Agent script got attached to the agents for some unknown reason. Removed it and its working now.

1 Like