HELP!!!! MLAgents aggregation

Hello! I am trying to make a script where a cube is the agent and it tries to aggregate itself in such a way, that it remains structurally stable (the reward). The new cube spawns on one of the faces of the previous cube. The new cube has a random size (and for later, random rotation).
I also want to add bounds and say that the agent gets a positive reward for not going out of the bounds, but again that is for later

I have written a basic script and yet something seems to be wrong. The spawning does not work in Heuristic. I am a beginner in this and right now, this seems impossible. Any help would be appreciated. Thank you so much. Please!!!

Attached you shall find the C# source file.

9686372–1381508–SelfSpawningAgent.cs (4.46 KB)

are you sure it’s not working or is it just because it’s in fixed update time and you’re trying to get the exact frame the spacebar was pressed?
fixed time and update time don’t line up that often so it’s best to do input checks in update or add some toggle to reset and use getkey instead of getkeydown in onactionreceived

2 Likes

Thank you so much for the suggestion. I’ll try it out and let you know

still does not work. Maybe i try to re-code the spawning logic. But still something should work. I rechecked the behaviour parameters. Behaviour set to heuristic, continuous actions = 1. Debug.log also does not bring up anything

do you have a decision requester component on the agent?