Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
17.2k stars 4.16k forks source link

Agent OnEnable() Error #1989

Closed patdavisgames closed 5 years ago

patdavisgames commented 5 years ago

Just updated to version 0.8, and I'm getting this error from the MLAgents.Agent.OnEnable(). I am enabling the academy and adding the agents with brains at runtime so that may be contributing to the issue.

NullReferenceException: Object reference not set to an instance of an object at MLAgents.Agent.OnEnable () [0x00001] in C:\Users\patra\Documents\Unity\Pin Puck\Assets\ML Agents Assets\ML-Agents\Scripts\Agent.cs:330 UnityEngine.GameObject:Internal_AddComponentWithType(Type)

That's line (330) in Agent.cs var textureCount = agentParameters.agentCameras.Count+agentParameters.agentRenderTextures.Count;

patdavisgames commented 5 years ago

Seems to be linked to creating the instances and attaching agents while the game is running as agents that're in the scene when it is created do not cause an error

shihzy commented 5 years ago

@harperj

harperj commented 5 years ago

@patdavisgames There are some cases where dynamically adding agents can be a problem -- I'm curious, did you manage to fix this issue? Were you trying to dynamically add / remove these agents in training or inference mode?

xiaomaogy commented 5 years ago

Thank you for the discussion. We are closing this issue due to inactivity. Feel free to reopen it if you’d like to continue the discussion though.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.