Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] Pool Boss - super easy pooling solution.

Discussion in 'Assets and Asset Store' started by jerotas, Oct 20, 2014.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Pool Boss has been released on the Asset Store!

    This flexible object pooling system is included in the Core GameKit system, but now you can purchase it as a standalone.

    Pooling is a necessity for all platforms and all game types. It helps avoid the costly Instantiate and Destroy calls that cause performance problems by re-using Game Objects.

    Pool Boss allows you to set up pre-loaded copies of any prefab, including Particle Systems. It's extremely easy and fast to set up and use. Addressables also supported!

    Use one short line of code to Spawn or Despawn your objects, or use the included Playmaker actions!

    Now has integration with Playmaker, Makinom and ORK Framework!

    Purchase now at: https://assetstore.unity.com/packages/tools/integration/pool-boss-23931

    Super easy to set up:


    Here are some of the main features:



    Click here for up to date documentation.

    Click here for the programming API.

    Purchase now at: https://assetstore.unity.com/packages/tools/integration/pool-boss-23931
     
    Last edited: Jul 15, 2020
  2. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    Very cool! All your products are very awesome!
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thanks 99thmonkey!
     
  4. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    do you plan on a networking support like photon.instanciate for example
     
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I don't know how to add that but it's a possibility. Let me know if you have any information about how that might work? I've been avoiding Photon because we use Bolt in-house.
     
    Last edited: Oct 28, 2014
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We're offering a special Halloween FREE sale for Pool Boss! We will return it to be a paid product after the first 250 downloads. Great time to get a solid product for nothing!

    Please do leave a review on the Asset Store after you've used it if you manage to be one of the lucky 250.
     
    Last edited: Oct 29, 2014
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I just downloaded it myself from the Asset Store and it appears to have lost all the meta files, so the main prefab and Example Scene were not working. We have fixed it and V 1.0.1 is on the Asset Store now. Sorry about this, but anyone who already downloaded will need to get the latest version.

    -Brian
     
  9. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    will we be able to get updates once it's not free anymore?
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes, forever :)

    That's how the Asset Store works. Doesn't matter what (or if) you paid, updates to the same product are free forever, regardless of how much the current price is.

    This is true unless the author does a move like Daikon Forge recently did and suddenly pulls their product off the store. We have no intention of ever doing that under any circumstance.
     
  11. R-Lindsay

    R-Lindsay

    Joined:
    Aug 9, 2014
    Posts:
    287
    Cheeky! I was just about to buy Pool Manager (currently on sale for 70% off), when this divine intervention stopped me :)
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Haha, well $9 for Pool Manager is a steal as well. That's also a good plugin, we have it. You can't go wrong either way.
     
  13. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    We don't need Pool Boss if we already have Core Game Kit, right?
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yep, you already have Pool Boss built in :)
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We now return to our normal price of $15, which is half the price of competing plugins :)
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  17. R-Lindsay

    R-Lindsay

    Joined:
    Aug 9, 2014
    Posts:
    287
    This might sound strange but your narrator has a soothing voice.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Cool :) I'm the narrator and the programmer as well by the way. Someone on another video said they like my voice as well.
     
  19. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    How does this compare to Pool Manager? Would it be considered a "lite" alternative, or does it do everything Pool Manager does? Thank you
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It does almost everything Pool Manager does. I didn't build the features that I personally think are useless or a bad idea, such as later Instantiating certain objects after Scene start, and allowing more than 1 pool.

    Actually, not allowing more than one pool means that there's no need for a "runtime pool item" script or whatever it's called. Anything can just despawn into the one pool.

    But then we have things that PM doesn't have, like a display of the count of spawned items per prefab, the ability to click on it to select them in the Scene, and a button to despawn all of that item.
     
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    $5 Insanity Sale is on through the end of November!
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Pool Boss is now free until the end of 2014! Happy holidays!

    If you enjoy it, please check out our other paid plugins :)
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We've had a TON of downloads. Please leave us a review on the Asset Store when you get a chance. The "free sale" only has one week left!
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Price will be going back up tomorrow, grab it for free now!
     
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Pool Boss V1.0.2 will be live in 20 minutes! Changelog:

    • Fixed warnings in the Console that occur if you spawn and despawn elements with the new uGUI components.
     
  26. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Hi Brian,

    I have a few suggestions if you don't mind:

    1 - Is it possible to drag multiple prefabs into an area in the inspector (much like with Core Audio) and have PB auto create the items? The reason I ask is that often when prototyping the scene layout changes and prefabs change structure, so having to drag and drop each one is time consuming.

    1a - Alternatively, is there any way of the results of "auto add missing items" being added to design-time so the next time you run, those items have been auto-created?

    2 - When setting this up with uFrame I found I had to create an array of transforms in the first instance and assign these with prefabs in the inspector (which I had already setup in Pool Boss), so that when I created an object I would have the right transform to specify what I wanted to create in the first instance. This seems like a bit of effort duplication because sometimes it may be convenient to simply create the object by name, so I added the following code as below in PoolBoss.cs to achieve this. The one caveat is that CreateMissingPoolItem is unavailable with this method. Not sure also about how fast this might be comparing to the original method.

    Anyhow, code is below, so any feedback much appreciated :)

    cheers

    Nalin

    BTW Sorry about code formatting - don't know how to do this after scanning the toolbar...

    //Nalin - SpawnbyName
    publicstaticTransformSpawnInPool(stringitemName, Vector3position, Quaternionrotation) {
    returnSpawn(itemName, position, rotation, Trans);
    }

    publicstaticTransformSpawn(stringitemName, Vector3position, Quaternionrotation, TransformparentTransform) {
    if (itemName == null) {
    Debug.LogError("No Transform name passed to Spawn method.");
    returnnull;
    }

    if (Instance == null) {
    returnnull;
    }

    if (!poolItemsByName.ContainsKey(itemName)) {
    if (PoolBoss.Instance.autoAddMissingPoolItems) {
    //CreateMissingPoolItem(transToSpawn, itemName, true);
    Debug.LogError("autoAddMissingPoolItems does not work with spawn by name");
    } else {
    Debug.LogError("The Transform '" + itemName + "' passed to Spawn is not in the Pool Boss.");
    returnnull;
    }
    }

    varitemSettings = poolItemsByName[itemName];

    if (itemSettings._despawnedClones.Count == 0) {
    if (!itemSettings._allowInstantiateMore) {
    Debug.LogError("The Transform '" + itemName + "' has no available clones left to Spawn in the Pool Boss. Please increase your Preload Qty or turn on Allow Instantiate More.");
    returnnull;
    } else {
    //Instantiateanewone
    varcurCount = NumberOfClones(itemSettings);
    if (curCount >= itemSettings._itemHardLimit) {
    Debug.LogError("The Transform '" + itemName + "' has reached its item limit in the Pool Boss. Please increase your Preload Qty or Item Limit.");
    returnnull;
    }

    varcreatedObjTransform = InstantiateForPool(itemSettings._sourceTrans, curCount + 1);
    itemSettings._despawnedClones.Add(createdObjTransform);

    if (PoolBoss.Instance.logMessages || itemSettings._logMessages) {
    Debug.LogWarning("PoolBoss Instantiated an extra '" + itemName + "' at " + Time.time + " because there were none left in the Pool.");
    }
    }
    }

    varrandomIndex = UnityEngine.Random.Range(0, itemSettings._despawnedClones.Count);
    varcloneToSpawn = itemSettings._despawnedClones[randomIndex];

    if (cloneToSpawn == null) {
    Debug.LogError("One or more of the prefab '" + itemName + "' in PoolBoss has been destroyed. You should never destroy objects in the Pool. Despawn instead. Not spawning anything for this call.");
    returnnull;
    }
    cloneToSpawn.position = position;
    cloneToSpawn.rotation = rotation;
    SetActive(cloneToSpawn.gameObject, true);

    if (PoolBoss.Instance.logMessages || itemSettings._logMessages) {
    Debug.Log("PoolBoss spawned '" + itemName + "' at " + Time.time);
    }

    cloneToSpawn.parent = parentTransform;

    cloneToSpawn.BroadcastMessage(SPAWNED_MESSAGE_NAME, SendMessageOptions.DontRequireReceiver);

    itemSettings._despawnedClones.Remove(cloneToSpawn);
    itemSettings._spawnedClones.Add(cloneToSpawn);

    returncloneToSpawn;
    }
     
    Last edited: Feb 15, 2015
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    #2, I already made this change last night (string instead of Transform) and it will be in the next update.
    #1, I was thinking about doing that. Yeah, I'll add it also.
     
  28. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    That's Awesome!
     
  29. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Instead of passing a transform object in SpawnOutsidePool, could you make it so we can just pass a string, which would be the transform name? Example would be:

    PoolBoss.SpawnOutsidePool("Tank",pos,rot);
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Already done and will be in the next version.
     
    jalapen0 likes this.
  31. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Dude, that's some service right there.
     
    jerotas likes this.
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Pool Boss V 1.0.3 will be live in 20 minutes. Changelog:

    • Add ability to spawn by name instead of passing in a Transform. This should prove useful when I get the Bolt Network compatibility working!
    • Added drag area to create multiple items at once by dragging them into the box when locking the Inspector.
    • Updated UI to look better. Matched with our other plugins' new UI colors and grouped boxes.
     
    jalapen0 likes this.
  33. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
  34. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Hey I upgraded to 1.03. Now when I do a poolboss.spawnoutsidepool, it spawns as a child of the poolboss gameobject anyways. It's like spawnoutsidepool and spawninpool do the same thing.
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You are right, I just reproduced and fixed the issue. A new version 1.0.3.1 will be live in 20 minutes with the fix. Sorry about that.
     
    jalapen0 likes this.
  36. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    No biggie. :)
     
    jerotas likes this.
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    V 1.0.4 will be live in 20 minutes. Changelog:

    - Fixed Playmaker custom actions not compiling from last version.
     
  38. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    I am having an issue with pool boss, when de-spawning in code.

    I am using transform.children to get all of a transform's children, and they were all spawned using pool boss.

    When I de-spawn, it removes exactly half of the children. If I call the method again, it de-spawns exactly half again. No code is executed between loops. So there should not be more items being added for it to remove.

    I have run all kinds of debugging, checking how many are there before and after, stepping through your code as it is running and it all seems to run, I can't find anything wrong with it.

    This is truly confounding for me, and I am missing deadlines fooling around trying to get the entire lists to de-spawn. Do you have any ideas?
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Calling Pool Boss' Despawn method only sets the Game Object (recursively) to disabled. It does not alter the number of children or anything else weird. So if that is happening, it's happening from some other non-Pool Boss script. Maybe you have a script on some of those child objects that calls Destroy when it becomes disabled or invisible.

    That's the only thing I can think of.

    I'm sure you'll find that if you remove all scripts from the child objects, this does not occur. Then you can start narrowing down which one causes it.
     
  40. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    Your despawn looks to move each item back to the poolboss transform, not just disable all the items. Am I incorrect?

    All the objects get disabled just fine. But they are not moved back to the poolboss pool, they remain on the object I spawned them on.
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yeah that's correct, they reparent when they despawn. That's mainly to prevent cluttering up the top level of the hierarchy with a bunch of inactive game objects.

    That behavior you're describing is "as designed". The child nodes have no knowledge where they came from. Once they are parented under something else they just become a part of it.

    It will not automatically happen when you despawn the parent, as you've seen. So, if you want the children to move back into Pool Boss as separate, you will have to call Despawn on each child that you want to despawn, prior to despawning the parent (or don't despawn the parent if you don't need to).
     
  42. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    I think you misunderstand.

    All the children under the parent are pooled items. In this case, a group of buildings.

    The parent spawns the children from pool boss (so the city spawns and places the buildings and gives its own transform as the parent). Then when I no longer have need of the city. I loop through the parent (city) transform, and grab every child and call despawn on it. I never despawn the parent, it is an "empty" object which just tells poolboss to spawn buildings or despawn them when the user is within range to use them.

    I despawn by looking for all child objects of the city (which are all spawned by poolboss and parented to its own transform) and then I call a simple de-spawn on them.

    When I check, all the items *look* like they have been de-spawned, in the game, but when I check in the hierarchy, HALF (always half, this is what is driving me crazy) is still there, but disabled.
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I just did a test with a for loop like what you're describing and it despawns only half because of basically "bad code" due to the loop counter. The others are *active* under the parent.

    But a while loop works. Like this:

    Code (csharp):
    1.  
    2. while (holder.childCount > 0) {
    3.     PoolBoss.Despawn(holder.GetChild(0));
    4. }
    5.  
     
    Last edited: Mar 7, 2015
  44. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    Thank you!

    Bad code? On my part? Can you explain why it does not work that way?
     
  45. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    When you despawn, it unparents the current child, and makes the number of children one fewer, so the parents' count decreases by one, while the counter increases by one. You basically skip every other child that way.
     
  46. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    How...interesting. I have been coding in c# for years and I would not have thought of that. Thank you for the explanation.
     
    jerotas likes this.
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I made the same mistake today until I thought about why for a minute. I've been programming 32 years. Unity is just very - yes, interesting - sometimes :)
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Pool Boss is on 80% off sale of $2 for the next 48 hours! Tomorrow Core GameKit is also 80% off, and Master Audio is 80% off as well starting today!!!
     
  49. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    I figured, hey, I'll finally look at the boss of pooling. I would expect a boss to be able to dynamically increase the pool size when all items are in use, along with a setting for how much to increase it when this happens. Went to try to post on the forum, got an error trying to post, came here. A static sized pool is just... weird. At least give the option for a dynamic sized pool.
     
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I left it out on purpose, kind of (read below).

    No one had asked for dynamic sizing yet. Me (and obviously a lot of other people) saw that feature in other plugins (create X more per second) as a useless bell & whistle. After all, even using Instantiate on a just a couple prefabs on lower powered devices can cause frame stutter, which is to be avoided at all costs.

    Now having said that, you can turn on "Allow Instantiate More" (and increase the Item Limit as well) in each pool item to un-static-size the item, which will create no more than your max.

    If you are looking for something different, please specify exactly what you are looking for.

    Thanks,
    -Brian

    P.S. Not sure what error you got on the forum, but we've had several new users in the past couple days...
     
    Last edited: Mar 30, 2015