Entitas  0.35.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Pools.cs
1 namespace Entitas {
2 
3  public partial class Pools {
4 
5  public static Pools sharedInstance {
6  get {
7  if(_sharedInstance == null) {
8  _sharedInstance = new Pools();
9  }
10 
11  return _sharedInstance;
12  }
13  set { _sharedInstance = value; }
14  }
15 
16  static Pools _sharedInstance;
17 
18  public static Pool CreatePool(string poolName,
19  int totalComponents,
20  string[] componentNames,
21  System.Type[] componentTypes) {
22  var pool = new Pool(totalComponents, 0, new PoolMetaData(
23  poolName, componentNames, componentTypes)
24  );
25  #if(!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR)
26  if(UnityEngine.Application.isPlaying) {
27  var poolObserver =
28  new Entitas.Unity.VisualDebugging.PoolObserver(pool);
29  UnityEngine.Object.DontDestroyOnLoad(
30  poolObserver.entitiesContainer
31  );
32  }
33  #endif
34 
35  return pool;
36  }
37  }
38 }