In my game, I have a turret that automatically shoots the chosen target. I use an agent to make decision on which enemy it targets. For this, I use discrete space type. My problem is the amount of the enemies change all the time and I don’t know how to change the range of the numbers OnActionReceived receives.
Here’s one option. Assuming you have a maximum number of enemies on the screen at any given point, the branch size would be this max number. Then you could mask out the ones that are unavailable. (ml-agents/docs/Learning-Environment-Design-Agents.md at main · Unity-Technologies/ml-agents · GitHub)