浏览代码

fix unregister agents

/MLA-1734-demo-provider
Ruo-Ping Dong 4 年前
当前提交
55265294
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 6
      com.unity.ml-agents.extensions/Runtime/Teams/BaseTeamManager.cs
  2. 2
      com.unity.ml-agents/Runtime/Agent.cs

6
com.unity.ml-agents.extensions/Runtime/Teams/BaseTeamManager.cs


public void Dispose()
{
Academy.Instance.PostAgentAct -= _ManagerStep;
foreach (var agent in m_Agents)
while (m_Agents.Count > 0)
agent.UnregisterFromTeamManager -= UnregisterAgent;
UnregisterAgent(m_Agents[0]);
}
}

{
if (!m_Agents.Contains(agent))
{
agent.SetTeamManager(this);
agent.SetTeamManager(this);
}
}

2
com.unity.ml-agents/Runtime/Agent.cs


internal void SetTeamManager(ITeamManager teamManager)
{
// unregister current TeamManager if this agent has been assigned one before
m_TeamManagerID = teamManager.GetId();
}
}
正在加载...
取消
保存