浏览代码

DemonstrationRecorder: Add numStepsToRecord feature. (#4381)

* add numSteps property and update recorder script

* add changes based on PR suggestions

* make zero default. update logic

* updated comments & tooltip
/MLA-1734-demo-provider
GitHub 4 年前
当前提交
ea3944fc
共有 2 个文件被更改,包括 24 次插入0 次删除
  1. 16
      com.unity.ml-agents/Runtime/Demonstrations/DemonstrationRecorder.cs
  2. 8
      com.unity.ml-agents/Runtime/Demonstrations/DemonstrationWriter.cs

16
com.unity.ml-agents/Runtime/Demonstrations/DemonstrationRecorder.cs


public bool Record;
/// <summary>
/// Number of steps to record. The editor will stop playing when it reaches this threshold.
/// Set to zero to record indefinitely.
/// </summary>
[Tooltip("Number of steps to record. The editor will stop playing when it reaches this threshold. " +
"Set to zero to record indefinitely.")]
public int NumStepsToRecord = 0;
/// <summary>
/// Base demonstration file name. If multiple files are saved, the additional filenames
/// will have a sequence of unique numbers appended.
/// </summary>

if (Record)
{
LazyInitialize();
}
if (NumStepsToRecord > 0 && m_DemoWriter.NumSteps >= NumStepsToRecord)
{
Application.Quit(0);
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
}

8
com.unity.ml-agents/Runtime/Demonstrations/DemonstrationWriter.cs


}
/// <summary>
/// Number of steps written so far.
/// </summary>
internal int NumSteps
{
get { return m_MetaData.numberSteps; }
}
/// <summary>
/// Writes the initial data to the stream.
/// </summary>
/// <param name="demonstrationName">Base name of the demonstration file(s).</param>

正在加载...
取消
保存