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.

Feature Request Failure to comprehend Migration Guide, specifically OnActionReceived

Discussion in 'ML-Agents' started by lemapp, Nov 23, 2022.

  1. lemapp

    lemapp

    Joined:
    Mar 30, 2020
    Posts:
    26
    Requested improved Migration documentation:
    I get the idea that there are those who understand "override OnActionReceived(float[] vectorAction) => agent.OnActionReceived(ActionBuffer actions)". To me this falls short. I do a search for Action Buffer and I'm directed to Unity's Visual Scripting resources. I know this is not the correct answer.

    Would it be reasonable to be directed to example code?

    Thanks in Advance for your attention.
     
  2. garytrickett

    garytrickett

    Joined:
    Sep 2, 2018
    Posts:
    66
    the actionbuffer holds the branches for the discrete and continuous actions chosen
    Code (CSharp):
    1. public override void OnActionReceived(ActionBuffers actions)
    2.   {
    3.     // action from discrete branch 0 choice
    4.     int act0 = actions.DiscreteActions[0];  
    5.     // branch 1
    6.     int act1 = actions.DiscreteActions[1];
    7.   }