浏览代码

Adding iteration delay to address issue with capturing in frames when scenes are still loading.

/h-i
Jon Hogins 3 年前
当前提交
05d56445
共有 1 个文件被更改,包括 19 次插入1 次删除
  1. 20
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs

20
com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs


public TextAsset configuration;
private bool m_ShouldRestartIteration;
private bool m_ShouldDelayIteration;
private const int k_MaxIterationStartCount = 100;
/// <summary>

do
{
m_ShouldRestartIteration = false;
m_ShouldDelayIteration = false;
iterationStartCount++;
foreach (var randomizer in activeRandomizers)
{

if (m_ShouldDelayIteration)
{
Debug.Log($"Iteration was delayed by {randomizer.GetType().Name}");
break;
}
if (m_ShouldDelayIteration)
break;
} while (m_ShouldRestartIteration && iterationStartCount < k_MaxIterationStartCount);
if (m_ShouldRestartIteration)

randomizer.Update();
// Iterate scenario frame count
currentIterationFrame++;
if (!m_ShouldDelayIteration)
currentIterationFrame++;
framesSinceInitialization++;
}

public void RestartIteration()
{
m_ShouldRestartIteration = true;
}
public void DelayIteration()
{
m_ShouldDelayIteration = true;
}
}
}
正在加载...
取消
保存