Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Can I have multiple Vector Sensors?

Discussion in 'ML-Agents' started by hyerra, Jul 23, 2023.

  1. hyerra


    Jan 24, 2023
    I want to use multiple Vector Sensors for my observations, due to different requirements in stacking and just better separation overall. However, I'm having some trouble doing so.

    First, I added an additional VectorSensorComponent to my agent in the editor. Then, in my Agent script, I run GetComponent<VectorSensorComponent>() and set it to `_vectorSensorComponent` to get the vector sensor component which works well. Then, whenever I receive some game related events that require updating the vector sensor, I try doing `_vectorSensorComponent.GetSensor().AddObservation(someObservation)`. All of this code runs fine; however, in the logs I notice that MLAgents is complaining that there were 0 observations recorded for this sensor even though I am sure the code to add observations is getting called (verified using Debug.Log).

    I was wondering if having multiple VectorSensors is supported, and if so, how to go about doing this.