Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Two different OnActionReceived(.. ) functions in Agent definition

Discussion in 'ML-Agents' started by paschok, May 27, 2021.

  1. paschok


    Apr 14, 2021
    Hi. I noticed that there are two OnActionReceived() functions in Agent.cs metadata definition :
    1. public virtual void OnActionReceived(ActionBuffers actions);
    2. public override void OnActionReceived(float[] vectorAction);
    and as I watch tutorials or search the Web people seem to have both of them. I, on the other hand, only have one:
    How I get only one installing from local disk, I understand : the thing could be, that in release_17 only the first one is present. Does this mean, that the second one is gone?

    There is also one follow up question : there is only one implementation of the function here (, which could explain why I get only the second version of the function from Unity's Registry no matter what version of ml-agent package I install. But still, I saw people have it. What is the trick here? This really bothers me..
    Christof_Stanits likes this.
  2. vincentpierre


    Unity Technologies

    May 5, 2017
    The second is an old api that was deprecated. The current API is OnActionReceived(ActionBuffers actions).
    If you are using a past version of ML-Agents, you may have currently deprecated APIs. The versions of ML-Agents that are on the registry are a subset of all the versions of ML-Agents (some later versions are missing). I suggest you install a newer version of the Unity Editor and get version 2.0 of ml-agents to have the latest APIs.
    Christof_Stanits likes this.