NullReferenceException: Object reference not set to an instance of an object
Unity.MLAgents.Inference.SentisModelInfo.CheckContinuousOutputs () (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Runtime/Inference/SentisModelInfo.cs:240)
Unity.MLAgents.Inference.SentisModelInfo.GetOutputNames () (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Runtime/Inference/SentisModelInfo.cs:211)
Unity.MLAgents.Inference.SentisModelInfo.CacheModelInfo () (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Runtime/Inference/SentisModelInfo.cs:112)
Unity.MLAgents.Inference.SentisModelInfo..ctor (Unity.InferenceEngine.Model model, System.Boolean deterministicInference) (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Runtime/Inference/SentisModelInfo.cs:50)
Unity.MLAgents.Inference.SentisModelParamLoader.CheckModel (Unity.InferenceEngine.Model model, Unity.MLAgents.Policies.BrainParameters brainParameters, Unity.MLAgents.Sensors.ISensor[] sensors, Unity.MLAgents.Actuators.ActuatorComponent[] actuatorComponents, System.Int32 observableAttributeTotalSize, Unity.MLAgents.Policies.BehaviorType behaviorType, System.Boolean deterministicInference) (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Runtime/Inference/SentisModelParamLoader.cs:151)
Unity.MLAgents.Editor.BehaviorParametersEditor.DisplayFailedModelChecks () (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs:159)
Unity.MLAgents.Editor.BehaviorParametersEditor.OnInspectorGUI () (at /Users/gwen/Team/AgentEngineer/Unity/tool-pkg/ml-agents/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs:93)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass82_0.<CreateInspectorElementUsingIMGUI>b__2 () (at /Users/bokken/build/output/unity/unity/Editor/Mono/UIElements/Inspector/InspectorElement.cs:797)
UnityEngine.GUIUtility:ProcessEvent(EntityId, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:224)
Not applicable (error is a full stack trace in the Unity Console/Inspector).
Bug Report: NullReferenceException in Unity SentisModelInfo when loading ONNX model exported by ML-Agents (PyTorch 2.x onnxscript dependency conflict)
Describe the bug
onnxscriptpackage, which causes a critical dependency conflict with ML-Agents' requiredonnx==1.15.0andprotobuf<3.21.onnxscript), Unity throws aNullReferenceExceptionin theSentisModelInfo.CheckContinuousOutputs()method when assigning the model to the Agent's Behavior Parameters.To Reproduce
Steps to reproduce the behavior:
config/ppo/3DBall.yaml).onnxscriptto bypass PyTorch 2.x dependency checks).Modelfield of the Agent'sBehavior Parameterscomponent in Unity.NullReferenceExceptionerror.Console logs / stack traces
Screenshots
Not applicable (error is a full stack trace in the Unity Console/Inspector).
Environment
Additional context
onnxscript, which requiresonnx>=1.16.0— this conflicts with ML-Agents' requiredonnx==1.15.0(the only version compatible with Unity Sentis).onnxscriptmodule bypasses the training error but produces an invalid ONNX model that Unity cannot parse.onnxscriptrequiresprotobuf>=4.25.1, while ML-Agents requiresprotobuf<3.21.