Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can't add academy script to academy

Discussion in 'ML-Agents' started by tanmoyio, May 30, 2020.

  1. tanmoyio

    tanmoyio

    Joined:
    May 30, 2020
    Posts:
    2
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Unity.MLAgents;
    public class PigAcademy : Academy
    {
    }
    this is my academy code, just a empty class,
    and the error is ---- 'Academy' does not contain a constructor that takes 0 arguments
     
  2. bobben

    bobben

    Joined:
    Jan 22, 2013
    Posts:
    12
    There is no need to inherit Academy
    use Academy.Instance
     
  3. tanmoyio

    tanmoyio

    Joined:
    May 30, 2020
    Posts:
    2
    And how to use Academy.Instance ? As there is no documentation present on academy
     
  4. bobben

    bobben

    Joined:
    Jan 22, 2013
    Posts:
    12
    //Initialize
    m_ResetParams = Academy.Instance.EnvironmentParameters;

    //SetResetParameters
    m_BlockRb.drag = m_ResetParams.GetWithDefault("block_drag", 0.5f);

    for randomize trainer, other usage unknown