Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question HELP!!!! MLAgents aggregation

Discussion in 'ML-Agents' started by arc112358, Mar 7, 2024.

  1. arc112358

    arc112358

    Joined:
    Mar 7, 2024
    Posts:
    3
    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.
     

    Attached Files:

  2. smallg2023

    smallg2023

    Joined:
    Sep 2, 2018
    Posts:
    154
    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
     
  3. arc112358

    arc112358

    Joined:
    Mar 7, 2024
    Posts:
    3
    Thank you so much for the suggestion. I'll try it out and let you know
     
  4. arc112358

    arc112358

    Joined:
    Mar 7, 2024
    Posts:
    3
    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
     
  5. smallg2023

    smallg2023

    Joined:
    Sep 2, 2018
    Posts:
    154
    do you have a decision requester component on the agent?