just a short one. I'm holding all my enemies in prefab pool, and get them to spawn random by getting a random game object reference from hashtable. Pool items active mode is set to world variable in range where range is the level the player is currently on.
The first version of what i was working on was something like this:
I have all the enemies from all the levels in prefab pool. I have hashtables for level1 enemies, level2 enemies etc. At the end of the level1, level 2 hashtable would concat to level1 hashtable, and then i would get random game object reference for both levels to spawn from prefab pool etc.
Now, i'm trying to avoid using multiple hashtables for enemies since it would be really hard to maintain, but i think i'll run into trouble that way, so i need some insight on inner workings of the prefab pool. So here's the question:
What happens when i try to spawn an item that is not active, i.e. the world variable for that item is not in range? I basically need something like spawn a random item from prefab pool, it the item is not active spawn something else, if that is not active, go on. Will it spawn a random prefab pool item if i leave prefab to spawn as none?
Post by DarkTonic Dev on Mar 10, 2018 18:40:50 GMT
This should really be in the Core GameKit forum, this forum is for standalone Pool Boss (doesn't have Prefab Pools).
Anyway, if you leave Prefab To Spawn as "none" it will not spawn anything. The Prefab Pool item active modes are only used when refilling the Prefab Pool (i.e. when you first start the Scene and after you spawn everything in the pool), so inactive items will never be in the weighted list of prefabs remaining in the pool. But if you suddenly changed a World Variable and want that to happen immediately in the pool (make the item inactive) you would need to make the Prefab Pool refill, there's a method you can call for that.
Oh, sorry about the missed forum, i'm using the asset for so long i forgot prefab pools are part of CGK.
Ok, so if i pull a gameobject reference from the hashtable that belongs to an item in the pool that is not active (i'm at level 1, and level 2 enemy is chosen to be spawned), it will simply not spawn anything?
well you're supposed to get the items from the prefab pool directly, then spawn them. I have no idea what that hashtable will do.
Just make a random reference since i can't spawn a random prefab from prefab pool without using syncro spawners. I know it sounds a bit quirky, but there are some specific wave types that can't be done with syncro spawners (some custom positioning, movement and behaviour based on location etc.).
Ok, thanks for clearing things up, now i know how i'll handle things