Esempio n. 1
0
        private void Awake()
        {
            // This will call the Init(...) function within the constructor
            _bulletPooler = new MonoPoolController <ExamplePooledBullet>(_poolInitData.prefab,
                                                                         _poolInitData.pooledContainer,
                                                                         _poolInitData.maxPoolSize,
                                                                         _poolInitData.optionalOnCreatedUnityEvent,
                                                                         _poolInitData.optionalOnSpawnUnityEvent,
                                                                         _poolInitData.optionalOnDespawnUnityEvent);

            //Quick way commented out below to init if you dont care about max size, and extra UnityEvents
            //_bulletPooler = new MonoPoolController<ExamplePooledBullet>(_test.prefab, _test.pooledContainer);
        }
Esempio n. 2
0
 private void OnDestroy()
 {
     //Don't forget to cleanup your pooler(s) when no longer needing them
     _bulletPooler?.OnCleanUp();
     _bulletPooler = null;
 }