Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    33
    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. smallg2023

    smallg2023

    Joined:
    Sep 2, 2018
    Posts:
    141
    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.   }