Skip to content

Instantly share code, notes, and snippets.

@psuong
Created February 23, 2019 20:10
Show Gist options
  • Save psuong/38d8248e13324df9403dd061797d038f to your computer and use it in GitHub Desktop.
Save psuong/38d8248e13324df9403dd061797d038f to your computer and use it in GitHub Desktop.
Test SetUp for ECS
public class ArenaTestFixtures {
protected World previousWorld;
protected World currentWorld;
protected EntityManager entityManager;
public RetrievalSystem RetrievalSystem {
get => World.Active.GetOrCreateManager<RetrievalSystem>();
}
[SetUp]
public virtual void SetUp() {
previousWorld = World.Active;
currentWorld = World.Active = new World("Test World");
entityManager = currentWorld.GetOrCreateManager<EntityManager>();
}
[TearDown]
public virtual void TearDown() {
if (entityManager != null) {
currentWorld.Dispose();
currentWorld = null;
World.Active = previousWorld;
previousWorld = null;
entityManager = null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment