Oshigawa
Full Member
 
Posts: 228
Posts: 228
|
Post by Oshigawa on Feb 4, 2019 15:45:24 GMT
Hi, I searched for the function in the API documentation, but i didn't find it. Is it possible to add items to prefab pools on runtime, and if yes, where can i find it in the documentation?
|
|
|
Post by DarkTonic Dev on Feb 4, 2019 17:12:43 GMT
No. That would kind of defeat the purpose of pooling, because you'd have to suddenly Instantiate a bunch of clones to fill up the pool, which would likely cause a frame lag.
|
|
Oshigawa
Full Member
 
Posts: 228
Posts: 228
|
Post by Oshigawa on Feb 4, 2019 18:17:42 GMT
Isn't the prefab pool just holding an array of references to objects in the Pool Boss? I didn't mean add new objects to the pool, there's CreateNewPoolItem for that, but insert or remove reference to the pool object.
|
|
|
Post by DarkTonic Dev on Feb 4, 2019 18:21:03 GMT
When you're in edit mode, yes, it's just a reference to a prefab. But once you hit play, it Instantiate the number of clones that you specified. It does this for all pool items before you can use PoolBoss.
I'm not sure what you're wanting to do then...
|
|
Oshigawa
Full Member
 
Posts: 228
Posts: 228
|
Post by Oshigawa on Feb 4, 2019 18:42:20 GMT
But PoolBoss does instantiations, not Prefab Pool?
Ok, let's say i have items 1, 2 and 3 in the Pool Boss. I have a Prefab Pool 1 with items 1 and 2 referenced and it does its thing with randomizing the spawns. During the runtime i want to add item 3 to the Prefab Pool 1 instead of making a Prefab Pool 2 which will have items 1, 2 and 3.
Sure, we have world variables to serve as thresholds when the item is active, but i was still curious about.
|
|
|
Post by DarkTonic Dev on Feb 4, 2019 19:07:24 GMT
Yeah, I was getting confused.
So, it's possible to do it, because the list of prefabs in the pool is public, but there's no helper method and I haven't tried it so it's not officially supported. Probably will work.
With a reference to the WavePrefabPool you want to change, add a new member to the poolItems collection of type WavePrefabPoolItem, with the specifics you want. The next time it refills (and you can call ResetPool method to do it immediately), the new item will be in there, ready to use.
|
|
Oshigawa
Full Member
 
Posts: 228
Posts: 228
|
Post by Oshigawa on Feb 5, 2019 6:08:34 GMT
Ahhh, like that. Great, thanks!
|
|
|
Post by DarkTonic Dev on Feb 5, 2019 7:03:20 GMT
No problem
|
|