Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question I have a 2D array of 1's and 0's that I wanna use as a sensor, what's the best way?

Discussion in 'ML-Agents' started by SajorDev, May 17, 2024.

  1. SajorDev

    SajorDev

    Joined:
    Mar 13, 2023
    Posts:
    7
    I am building a 2D tile grid game and I want the Agent to be able to see the board state.
    I tried a grid sensor but it keeps telling me the shape of the grid is wrong and I read that it is a bug that can be fixed by updating ML Agents, but I am already using 3.0.0-exp.1, the same shape error comes up when I use the camera sensor.
    So, I feel like 2D array is my best bet.

    I have a 2D array of 1's and 0's that I wanna use as a sensor, I currently have it like this:


    I am using AddOneHotObservation, and I feel like this seems wrong is the sensor really seeing it as a 2D grid? I feel like it's not.

    Any insight would be much appreciated.