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.

Manually switch behavior type

Discussion in 'ML-Agents' started by mmmbop, Aug 18, 2022.

  1. mmmbop

    mmmbop

    Joined:
    Jan 22, 2022
    Posts:
    20
    I need change behavior type of my Agent when episode is end. Because my agent have rigibodies and relies on physics, resetting position with failing cause bad results when i agent trying to reset at start position, because at this time he tries to move ( he got NN attached).
    So it is possible to change with code BehaviorType of my Agent to heuristic and back to NN?
    I found that this not working
    Code (CSharp):
    1. GetComponent<Unity.MLAgents.Policies.BehaviorParameters>().BehaviorType=1
    and this didnt find component "Behavior parameter":
    Code (CSharp):
    1. GetComponent<BehaviorParameters>().BehaviorType = 1;
    How to access it manually? I need to turn off NN, replace my agent without any rigidbody/physics troubles and turn NN on again.
     
  2. garytrickett

    garytrickett

    Joined:
    Sep 2, 2018
    Posts:
    62
    you can make the rigidbody kinematic, move it, then switch it back to dynamic