Search Unity

Question I'm Getting an error in Code Monkey's "How to use Machine Learning AI in Unity! (ML-Agents)"Tutorial

Discussion in 'ML-Agents' started by Bobby1113, Nov 28, 2021.

  1. Bobby1113

    Bobby1113

    Joined:
    Oct 18, 2021
    Posts:
    3
    Never mind, I resolved myself. I just needed to add a rigidbody to the agent and mark it as "Is Kinematic" for this to work. Sorry for the noob question.

    Thanks,
    Bobby


    I'm having an issue in Code Monkey's "How to use Machine Learning AI in Unity! (ML-Agents)" tutorial.

    I was getting an error, but I upgraded my ml-agents version from 1.0.8 to 2.01 while waiting on a response and the error went away. Now I'm trying to run "Heuristic Only" but it is never jumping into my "OnTriggerEnter" function. I've checked over and over and all my colliders are marked as "Is Trigger". Any ideas what else could be causing this, or what other information I could provide that would be helpful?

    private void OnTriggerEnter(Collider other)
    {
    Debug.Log("in ontriggerenter");
    if (other.TryGetComponent<Goal>(out Goal goal))
    {
    Debug.Log("hit goal");
    SetReward(+1f);
    EndEpisode();
    }
    if (other.TryGetComponent<Wall>(out Wall wall))
    {
    Debug.Log("hit wall");
    SetReward(-1f);
    EndEpisode();
    }
    }
     
    Last edited: Nov 29, 2021