您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
1.0 KiB
36 行
1.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using NUnit.Framework;
|
|
using UnityEngine;
|
|
using UnityEngine.Perception.GroundTruth;
|
|
using Object = UnityEngine.Object;
|
|
|
|
namespace GroundTruthTests
|
|
{
|
|
public class GroundTruthTestBase
|
|
{
|
|
List<GameObject> m_ObjectsToDestroy = new List<GameObject>();
|
|
[TearDown]
|
|
public void TearDown()
|
|
{
|
|
foreach (var o in m_ObjectsToDestroy)
|
|
Object.DestroyImmediate(o);
|
|
|
|
m_ObjectsToDestroy.Clear();
|
|
|
|
SimulationManager.ResetSimulation();
|
|
Time.timeScale = 1;
|
|
if (Directory.Exists(SimulationManager.OutputDirectory))
|
|
Directory.Delete(SimulationManager.OutputDirectory, true);
|
|
}
|
|
|
|
public void AddTestObjectForCleanup(GameObject @object) => m_ObjectsToDestroy.Add(@object);
|
|
|
|
public void DestroyTestObject(GameObject @object)
|
|
{
|
|
Object.DestroyImmediate(@object);
|
|
m_ObjectsToDestroy.Remove(@object);
|
|
}
|
|
}
|
|
}
|