Search Unity

Resolved Unity does not recognise MLAgents namespace

Discussion in 'ML-Agents' started by Jvln1339, Aug 7, 2020.

  1. Jvln1339

    Jvln1339

    Joined:
    Feb 3, 2020
    Posts:
    2
    Hello,
    Im making a 2D game and trying to set up some agents, so I installed ML Agents using the package manager, but when I try to make the agent scripts I keep getting the error
    Assets/PlaneAI.cs(4,7): error CS0246: The type or namespace name 'MLAgents' could not be found (are you missing a using directive or an assembly reference?
    Anyone know whats going wrong?
     
    zhiligeng likes this.
  2. tracheotommy

    tracheotommy

    Joined:
    Jul 2, 2020
    Posts:
    1
    using Unity.MLAgents;
     
    HIT051322, zhiligeng and Jvln1339 like this.
  3. Jvln1339

    Jvln1339

    Joined:
    Feb 3, 2020
    Posts:
    2
    Thank you Ive been stuck on that for ages
     
  4. betike

    betike

    Joined:
    May 28, 2019
    Posts:
    18
    I have this and I am still getting the error in console. Any advice? Thanks

    B
     
  5. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
  6. betike

    betike

    Joined:
    May 28, 2019
    Posts:
    18
    it was a path issue,its working now thanks
     
    omar-tahraoui likes this.
  7. quxinghua17

    quxinghua17

    Joined:
    Nov 27, 2020
    Posts:
    1
    How do you fix the Path issue? I met the same error: Assets\ML-Agents\Examples\Template\Scripts\TemplateAgent.cs(3,22): error CS0234: The type or namespace name 'Actuators' does not exist in the namespace 'Unity.MLAgents' (are you missing an assembly reference?)
     
  8. phingermee

    phingermee

    Joined:
    Sep 8, 2020
    Posts:
    1
    Main problem is that current version of "ML-Agents package" in Unity doesn't include "ML-Agents Extensions" which is used in example project
    To fix this:
    First instal Package from Unity Manager
    Then you have to download current release version from git
    After it you got 2 ways to install needed package:
    1. Instal using link to github
    In the Package Manager hit the "+" button, and select "Add package from git URL" (<- This one wont solve problem at the moment cause git owner has to accept your request)
    Place there:
    git+https://github.com/Unity-Technologies/ml-agents.git?path=com.unity.ml-agents.extensions
    Or in the your manifest.json file located in Project -> Packages add next line below "com.unity.ml-agents":
    "com.unity.ml-agents.extensions": "git+https://github.com/Unity-Technologies/ml-agents.git?path=com.unity.ml-agents.extensions",
    2. Local Instalation
    In the Package Manager hit the "+" button, and select "Add package from disk"
    Find "com.unity.ml-agents" in downloaded repo
    Select "package.json"
    Then same steps but with "com.unity.ml-agents.extensions" folder
    (After it you also may spot "UnityEditor.AsyncHTTPClient:Done(State, Int32)" error, it easily fixes by disabeling Edit -> Preferences -> Show Asset Store Search Hits )
     
  9. KevinTchokodeu

    KevinTchokodeu

    Joined:
    Jan 26, 2021
    Posts:
    1
    It works by me! Thank you so much!
     
  10. Alca-Lynn

    Alca-Lynn

    Joined:
    Sep 8, 2020
    Posts:
    5
    i have done both of the methods, but still get the same error. How?
     
  11. Kingsmen99

    Kingsmen99

    Joined:
    Feb 4, 2021
    Posts:
    2
    I am also experiencing the same issue, every video that I watch does not address this. When I open up any of the example scrips from "Project" none of the ML Agent packages are being imported so the code doesn't light up with any information.
     
    eryberto87 likes this.
  12. christophergoy

    christophergoy

    Joined:
    Sep 16, 2015
    Posts:
    735
    Hi @Kingsmen99,
    I saw your post in the other thread. Can you provide more information like:
    • what operating system are you on and what version
    • what version of unity are you using
    • what code editor are you using
    • any other additional information about your installation process
    It is easier to diagnose issues like this with more information.
    Cheers,
    Chris
     
  13. hrithiksagar36

    hrithiksagar36

    Joined:
    Sep 10, 2021
    Posts:
    1
    Can u explain me how to do this? consider I'm a beginner.