浏览代码

Merge pull request #279 from Unity-Technologies/addressables-test-scenario-fix

stapled scenario back together
/addressables-test
GitHub 4 年前
当前提交
e9638616
共有 2 个文件被更改,包括 25 次插入32 次删除
  1. 7
      com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs
  2. 50
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs

7
com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs


Label m_PrevExecutionIdLabel;
RunParameters m_RunParameters;
const string m_SupportedGPUString = "NVIDIA";
const string k_SupportedGPUString = "NVIDIA";
[MenuItem("Window/Run in Unity Simulation")]
static void ShowWindow()

: m_RunParameters.currentScenario.SerializeToJson());
var constants = configuration["constants"];
if (constants == null)
{
constants = new JObject();
configuration["constants"] = constants;
}
constants["totalIterations"] = m_RunParameters.totalIterations;
constants["instanceCount"] = m_RunParameters.instanceCount;

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


using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;

void Update()
{
// There are two known issues with the starting simulations on the first frame: rendered frames cannot be
// captured and the WaitForEndOfFrame will not function properly on the first frame.
if (Time.frameCount == 1)
return;
switch (state)
{
case State.Initializing:

void IterationLoop()
{
// Perform new iteration tasks
if (currentIterationFrame == 0)
{
ResetRandomStateOnIteration();
OnIterationStart();
foreach (var randomizer in activeRandomizers)
randomizer.IterationStart();
}
// Perform new frame tasks
OnUpdate();
foreach (var randomizer in activeRandomizers)
randomizer.Update();
StartCoroutine(EndOfFrameIterationLoop());
}
IEnumerator EndOfFrameIterationLoop()
{
yield return new WaitForEndOfFrame();
// Iterate scenario frame count
currentIterationFrame++;
framesSinceInitialization++;
// Increment iteration and cleanup last iteration
if (isIterationComplete)
{

OnComplete();
state = State.Idle;
OnIdle();
return;
// Perform new iteration tasks
if (currentIterationFrame == 0)
{
ResetRandomStateOnIteration();
OnIterationStart();
foreach (var randomizer in activeRandomizers)
randomizer.IterationStart();
}
// Perform new frame tasks
OnUpdate();
foreach (var randomizer in activeRandomizers)
randomizer.Update();
// Iterate scenario frame count
currentIterationFrame++;
framesSinceInitialization++;
}
/// <summary>

正在加载...
取消
保存