Use C# files for debugging instead of dll?

Hello everyone,

is there an easy way to step through the source-code of ML-agents while debugging?

Let’s say I want to see the code of Agent.cs. If I inherit from this class, then right-click on the " : Agent" part, select “See Definition”, all I get is the header file.

#region Assembly Unity.ML-Agents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// C:\Users\myUser\Documents\myProjectFolder\ml-agents\UnitySDK\Library\ScriptAssemblies\Unity.ML-Agents.dll
#endregion

using System.Collections.ObjectModel;
using Unity.Barracuda;
using Unity.MLAgents.Policies;
using Unity.MLAgents.Sensors;
using UnityEngine;
using UnityEngine.Serialization;

namespace Unity.MLAgents
{
    [HelpURL("https://github.com/Unity-Technologies/ml-agents/blob/release_5_docs/docs/Learning-Environment-Design-Agents.md")]
    [RequireComponent(typeof(BehaviorParameters))]
    public class Agent : MonoBehaviour, ISerializationCallbackReceiver
    {
        [FormerlySerializedAs("maxStep")]
        [HideInInspector]
        public int MaxStep;

        public Agent();

        public int StepCount { get; }
        public int CompletedEpisodes { get; }

        protected static float ScaleAction(float rawAction, float min, float max);
        public void AddReward(float increment);
...

If I try to single-step from any code that was called from ML-agents the debugger just skips the ML-agents part.

I installed ML-agents through the package manager.
If I try to copy and paste folders from the main-directory into my project (“com.unity.ml-agents”, “com.unity.ml-agents.extensions”), I get a whole bunch of missing dependencies.

Can I somehow tell Visual Studio where the corresponding C#-files for the dll are located?

Hi,
Since this applies to debugging packages in general (not just ML-Agents), you might get some better responses in a more general forum.

The .cs files for packages that you have installed should be in {project directory}/Libary/PackageCache/. I don’t have Visual Studio setup, but I can confirm that setting a breakpoint on these files works in Rider.