problem with the OnEnvironmentReset delegate

I am having trouble designing a flexible training set up which would allow for multiple different agents to train, or either of these agents to train alone. At the moment, I have it set up so that the delegate I added to Acedemy.Instance.OnEnvironmentReset is called at the beginning of training. This sets up the environment and spawns the agents. After the initial set up, I then call this method when each episode ends - to reset the environment and the agent positions. Because of this, adding multiple agents to the scene would (I think) cause environment restarting delegate to be called multiple times (by as many times as there are agents scene).

Is there a way to add a delegate that would be called whenever an episode begins? I am not aware of a mechanism for controlling the environment which is agent-independent, aside from the delegate added to OnEnvironmentReset, but this is only called once at the start of training.

For single agents, you can override the Agent.OnEpisodeBegin() method.

For groups of agents, there’s nothing built-in. You can see an example of how to handle this in our Soccer scene; when a goal is scored, each agent gets rewarded and their episode is ended. The OnEpisodeBegin method is used to actually reset the position of the Agent.

The problem I have with my training scenario is that the reset positions of the agents will not be known until an external class has generated the environment and allocated agent positions.

I am looking for a way to initialise this process without calling it from an agents on episode begin.