Example #1
0
        private void Initialize()
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;

            if (_tempContainer == null)
            {
                _tempContainer = new GameObject(TEMP_CONTAINER_NAME).AddComponent <PoolContainer>();
            }

            _tempContainer.RegisterOnDestroy(SceneTransitioning);

            if (_persistedContainer == null)
            {
                _persistedContainer = new GameObject(PERSISTED_CONTAINER_NAME).AddComponent <PoolContainer>();
                _persistedContainer.SetAsPersisted();
            }

            if (persistAcrossScenes)
            {
                _persistedContainer.RegisterOnLevelWasLoaded(Reregister);
            }
        }