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

How do I put academy in the latest version?

Discussion in 'ML-Agents' started by Fi2nick, Mar 28, 2020.

  1. Fi2nick

    Fi2nick

    Joined:
    Mar 27, 2020
    Posts:
    2
    In the latest version do we still need to manually write a script and initialize academy?
    In all the official examples, the academy is only called inside decision requester.
    If I don't need a decision requester, should I initialize academy with
    Academy.Instance.AgentSetStatus += MakeRequests; manually?
     
  2. LexVolkov

    LexVolkov

    Joined:
    Sep 14, 2014
    Posts:
    62
    in the "Basic" example they offer this option:

    Code (CSharp):
    1. public void FixedUpdate()
    2.     {
    3.         WaitTimeInference();
    4.     }
    5.  
    6.     void WaitTimeInference()
    7.     {
    8.         if (Academy.Instance.IsCommunicatorOn)
    9.         {
    10.             // Apply the previous step's actions
    11.             ApplyAction(m_Agent.GetAction());
    12.             m_Agent.RequestDecision();
    13.         }
    14.         else
    15.         {
    16.             if (m_TimeSinceDecision >= timeBetweenDecisionsAtInference)
    17.             {
    18.                 // Apply the previous step's actions
    19.                 ApplyAction(m_Agent.GetAction());
    20.  
    21.                 m_TimeSinceDecision = 0f;
    22.                 m_Agent.RequestDecision();
    23.             }
    24.             else
    25.             {
    26.                 m_TimeSinceDecision += Time.fixedDeltaTime;
    27.             }
    28.         }
    29.     }
    But this does not work like Academy.Instance.AgentSetStatus += MakeRequests;
    worse
    I don’t know what is the reason
    also interested in this question
     
  3. christophergoy

    christophergoy

    Joined:
    Sep 16, 2015
    Posts:
    735
    Hi,
    The Academy class is now a singleton and does not need to be inherited from, and cannot exist as a game object anymore. It will be initialized the first time its Instance method is called.