This repository was archived by the owner on Mar 25, 2020. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 5
ComponentPool
pointcache edited this page Jan 17, 2017
·
2 revisions
ComponentPool is a pretty complex class implementing generic static Pool
Once a Component is spawned into the scene it registers itself in the pool, which is automatically created for new types of components.
You can access first component in the pool, use this for "singleton" components:
varcfg=Pool<GraphicsConfig>.First;You can get the list of all currently existing in the scene components:
foreach(BirdbirdinPool<Bird>.components){Fly();}You can subscribe to get notified when components are added or removed to the pool:
Pool<Star>.OnAdded+=()=>PlaySound();There are other things you can use
Pool<T>.Empty//is the pool emptyPool<T>.Count //how many components There are other internal members you probably won't need.