generate Input.GetKeyDown("space") event from agent.

Hi ,

Lets say I have a existing game in which I use GetKeyDown("space") for character Jump , Now with agent action I want to control the Jump without disturbing the original code i.e agent should generate "space" presses instead of human.

How do I pass actions from my agents to unity input system without or with minimal modification to original code ? this will enable to easily create a agent without disturbing the original game.



It is currently not possible to add ML-Agents to a game that uses the input system without some amount of code changes. It isn't possible for the agent to generate a virtual key press. I would recommend taking a look at the Heurstic function, and see whether you can put the space check in there. That may allow you to use an ML-Agents agent under the hood for your behavior.

Thanks you , I will look into it.