Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
16.93k stars 4.14k forks source link

Compile error in Brainparameters.cs, possibly related to API compatibility level #2896

Closed ruanrothmann closed 4 years ago

ruanrothmann commented 4 years ago

Hi,

I'm trying to integrate the ML-Agents unity package into an existing Unity project of mine, but ML-Agents does not compile.

Specifically, it fails in Brainparameters.cs, line 129, with a cast error:

Assets\ML-Agents\Scripts\BrainParameters.cs(129,17): error CS1503: Argument 1: cannot convert from 'object[]' to 'MLAgents.CommunicatorObjects.ResolutionProto[]'

And 3 other near-identical errors.

The cast should be possible due to an extension method which is part of System.Linq, but Unity/Rider is not picking it up. In fact the "using System.Linq" directive is greyed out as well.

I have definitely set my API compatibility level to 4.x, and reimported all, deleted all csproj files, closed unity/removed all csproj, THEN set api compatibility, restarted Unity/VS a dozen times to no avail. Is there something I am missing here, or perhaps this could be due to another cause? I feel like I'm missing some tickbox or setting somewhere but have gotten nowhere the past 5 hours :(

Using ML-Agents v.10 and Unity 2019.12.

ruanrothmann commented 4 years ago

Resolved - another package that I was using was also providing a ToArray Extension method, which seemed to confuse all involved compilers without throwing any errors that really pointed in that direction. I found out by creating a new project and piecewise importing the old project.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.