AOI Test: use CreateGameObject for automated tracking & destroying

This commit is contained in:
vis2k 2021-08-07 13:37:47 +08:00
parent 5c8bd25b7e
commit 0888776f06

View File

@ -11,18 +11,19 @@ public class InterestManagementTests_Distance : InterestManagementTests_Common
[SetUp] [SetUp]
public override void SetUp() public override void SetUp()
{ {
GameObject go = new GameObject(); base.SetUp();
// create AOI GameObject
CreateGameObject(out GameObject go);
aoi = go.AddComponent<DistanceInterestManagement>(); aoi = go.AddComponent<DistanceInterestManagement>();
aoi.visRange = 10; aoi.visRange = 10;
// setup server aoi since InterestManagement Awake isn't called // setup server aoi since InterestManagement Awake isn't called
NetworkServer.aoi = aoi; NetworkServer.aoi = aoi;
base.SetUp();
} }
[TearDown] [TearDown]
public override void TearDown() public override void TearDown()
{ {
GameObject.DestroyImmediate(aoi.gameObject);
base.TearDown(); base.TearDown();
// clear server aoi again // clear server aoi again
NetworkServer.aoi = null; NetworkServer.aoi = null;