Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[Released] Fast Pool - Fastest pooling solution

Discussion in 'Assets and Asset Store' started by ExE, Jul 21, 2015.

  1. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Hello everyone!
    There is a good news - Fast Pool has been released on the Asset Store :)

    As you know, Instantiate / Destroy calls is very expensive and may cause performance problems. Pooling helps to avoid this by re-using created objects, instead of destroying and instantiating it.

    Download here: https://www.assetstore.unity3d.com/en/#!/content/38709

    After a long time we search the better pooling solution in the asset store, we found that there is no one that fulfill our requirements. One of them is a very laggy, another has poor functionality. So we decide to write our own solution. Benchmarking and comparing performance with other pooling tools shows that our Fast Pool is the fastest solution in the Asset Store. And we will give a free copy of Fast Pool to the first five users that find much faster solution (with the same functionality).


    Main Features:
    - As fast as a flash
    - Great for mobile devices
    - Supports all types of objects
    - Easy integration and intuitive user interface
    - GameObject and Component extensions to make pooling easier
    - OnFastInstantiate and OnFastDestroy events to handle object spawning
    - A lot of helpful examples

    Purchase Fast Pool Now

    Screenshots:
    Screen 1.png Screen 2.png Screen 3.png
     
  2. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    Does it have a FIFO mode ? ( Despawning the oldest items to make room for the newests)
     
  3. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    324
    A webplayer demo to try before buy would be good !
     
  4. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    It uses stack to organize despawned objects, so it woks in LIFO mode (First despawned objects will be spawned last).
    The trick is to handle only despawned objects. Using FIFO in this case is a bad idea, because it has performance issues (need to rearrange item indexes in the queue every time a new object is added). If despawned objects stack is full (in case you limit its size) and you try to despawn object - it will be simply destroyed rather than added to the pool.
     
  5. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    It will be added this week :)
     
  6. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Madness SALE!
    Fast Pool is now 54% off

    You can buy it only for $4.5 !

     
  7. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    324
    Could you make a webplayer demo for test before buy ?
     
  8. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Hi there! I'm just converting my project to Fast Pool. Wondering how to FastDestroy() a GameObject instance without knowing its pool? It seems I need to retrieve the pool before being able to do that? I do something like this, but I'm not sure if that's correct or even gets the right pool.

    Code (CSharp):
    1. this.pool = FastPoolManager.GetPool(objectToRemove, false);
    2. if (this.pool != null) {
    3.     this.pool.FastDestroy(objectToRemove);
    4. }
     
    Braza likes this.
  9. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    To be specific, how do I FastDestroy an instance without knowing pool or prefab. Or do I need to keep track of that myself for all instances?
     
    Braza likes this.
  10. eToledom

    eToledom

    Joined:
    Apr 7, 2015
    Posts:
    3
    I also got this asset and I was playing with it today.
    For what I noticed, if you try to use GetPool() with the instance of the gameObject, it won't work (I tried it). You will need to get the reference of the Prefab itself somehow. This use the InstanceID to get the right Pool and the ID changes from Prefab to instantiated object.

    The other possibility would be to use instance.FastDestroy(Pool); , but how you can notice, in this case you will need the reference of the pool itself.

    This shouldn't be a problem if you use the same script to instantiate and destroy the objects, but I had a generic "Destroy" script and this was an interesting problem to solve without loosing the "generic" part of the script.

    At the end I did this:

    I created this little script and added to all the prefabs I intended to Destroy using the Pool.
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class Pooleable : MonoBehaviour {
    5.     public FastPool pool;
    6.     public void Destroy(){
    7.         gameObject.FastDestroy(pool);
    8.     }
    9.  
    10. }
    Then to instantiate an object I do this:
    Code (CSharp):
    1.        
    2. var pool = FastPoolManager.GetPool(Prefab);
    3. var pooleable = pool.FastInstantiate<Pooleable>();
    4. pooleable.pool = pool;
    5.  
    In this way, all instances will know from which pool are they.

    And finally, I can destroy them from anywhere:
    Code (CSharp):
    1.  
    2. gameObject.GetComponent<Pooleable>().Destroy();
    3.  
    At least is working for me. Would be good if the developer can make this "destroying" easier, In general I found this asset quite useful.

    Also for the developer:
    I noticed that the counter in the FastPoolManager is not working. It just work in public FastPool properties other than the Manager. At the beginning I thought I was doing something wrong but Im pretty sure now it's a bug.
     
    Last edited: Aug 15, 2015
    Braza likes this.
  11. eToledom

    eToledom

    Joined:
    Apr 7, 2015
    Posts:
    3
    By the way, If Im wrong, or if there's a better way to do this, will be nice to know :)
    I know GetComponent is not the fastest thing to do, but for my use was good enough.
     
  12. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Yeah eToledom, I'm doing the same at the moment. Storing a reference to the prefab on each instance. I'm thinking a reference to the pool - like you are doing - may be more memory-efficient that a reference to the prefab. Need to run a few tests to check that...
     
    Daegit likes this.
  13. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Hello guys, thanks for your questions :)

    In most cases objects that can be pooled spawns from the some "manager" script. If you have the same architecture - you can add the public field that holds source prefab in your manager script. And when you need to destroy object - you can use
    Code (CSharp):
    1. //if you destroy object from itself)
    2. FastPoolManager.GetPool(YourManagerClass.Instance.Prefab, false).FastDestroy(gameObject);
    3.  
    4. //or
    5.  
    6. //if you destroy object from the manager
    7. FastPoolManager.GetPool(Prefab, false).FastDestroy(objectToRemove);
    In case if you don't want to make your manager script singleton, you can create a separate singleton script that will holds all the needed source prefabs.

    If you don't love singletons and don't want use it - then you can use solution by eToledom.
     
  14. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Hello! Is there any way to make initial pooled objects to be set as children of an specific object?
     
  15. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Hello,
    Yes. If you toggle "Parent on Cache" checkmark - all pooled objects will be parented to the object which holds FastPoolManager script. But I don't recommend to do this, because reparenting is a costly procedure and with a huge amount of objects it can make performance down.
     
  16. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Thanks. Tried that, but it seems it wasn't parenting them.
    It was just due to the fact that all these pooled objects create a big mess on my project :/
     
  17. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
  18. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    126
    I came here with the very same problem...
    Improving the package for scenarios with separate spawners and destroyers would really make it more convenient.
     
  19. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    126
    Do you know what could cause this bug^
    Code (CSharp):
    1. ArgumentException: An element with the same key already exists in the dictionary.
    2. System.Collections.Generic.Dictionary`2[System.Int32,FastPool].Add (Int32 key, .FastPool value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
    3. FastPoolManager.Start () (at Assets/FastPool/Scripts/FastPoolManager.cs:39)
     
  20. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    126
    I have an array of prefabs as GameObjects. This spawner object picks random prefab from this list and instantiates it. Instances may or may not maintain original rotation. Not sure if it is valuable.

    For some reason this code generates new FastPool even for the same prefab at each Spawn. So I end up having many 1/Infinity Fast Pools. What Am I doing wrong?

    Code (CSharp):
    1. private void Spawn()
    2.     {
    3.         GameObject spawned = prefabsToSpawn[Random.Range(0, prefabsToSpawn.Length)];
    4.         Quaternion rotation = spawned.transform.rotation;
    5.         if (ori == SpawnOrientation.RAND)
    6.         {
    7.             rotation = Quaternion.AngleAxis(Random.value*360, Vector3.up);
    8.         }
    9.         FastPool pool = FastPoolManager.GetPool(spawned);
    10.         Pooleable pooleable = pool.FastInstantiate<Pooleable>(this.transform.position, rotation);
    11.         if (pooleable)
    12.         {
    13.             pooleable.pool = pool;
    14.             Spawned(this, pooleable.gameObject);
    15.         }
    16.  
    17.  
    18.     }
     
  21. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Go to the ProjectSettings -> Script Execution Order and make the FastPoolManager will execute before your scripts in which it is used
     
  22. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    I'm copy your code in the empty project and all works correctly. But I'm exclude this lines:
    Code (CSharp):
    1.         if (pooleable)
    2.         {
    3.             pooleable.pool = pool;
    4.             Spawned(this, pooleable.gameObject);
    5.         }
    So I think the problem is in your Spawned() method.
     
  23. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    126
    That worked, thanks!

    The problem appeared to be in my destroy method which I have not provided.
    Thanks!
     
  24. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Just chiming in to say that I'm having a good time using Fast Pool. Thanks!
     
  25. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Update
    version 1.1

    New Features:
    + FastPoolManager: Pool reordering in the inspector
    + FastPoolManager: Adding pools by Drag-and-Drop
    + FastPoolManager: Ability to create pools with custom IDs (via inspector and code)
    + FastPool: Added arrow on the header in the inspector (like on the foldout)
    + Ability to auto despawn audio sources and particles when it stops playing
    + Ability to auto despawn any gameObject after the specified period of time
    + Online documentation
    + More examples

    Also added a short Video trailer where you can see performance increase by using FastPool compared to Unity's Instantiate.

     
    ikemen_blueD likes this.
  26. eddie312

    eddie312

    Joined:
    Sep 13, 2012
    Posts:
    24
    just tried the new version and the Example 7 (autodespawn) is not working on my unity 5.2.0f3
    error are

    Creating pool with null object
    UnityEngine.Debug:LogError(Object)
    FastPoolManager:CreatePool(Int32, GameObject, Boolean, Int32, Int32) (at Assets/FastPool/Scripts/FastPoolManager.cs:130)
    FastPoolManager:GetPool(Int32, GameObject, Boolean) (at Assets/FastPool/Scripts/FastPoolManager.cs:170)
    FastPoolExtensions:FastDestroy(GameObject, Int32) (at Assets/FastPool/Scripts/Stuff/FastPoolExtensions.cs:38)
    <Despawn>c__Iterator0:MoveNext() (at Assets/FastPool/Scripts/Tools/FPUniversalDespawner.cs:123)
     
  27. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Thank you for feedback! We will fix it as soon as possible.
     
  28. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    @ExE Same error here. Do you have an interim fix, ie a replacement for auto destroy we could download meanwhile please? it is occuring with my nested particle systems :/

    Also: The pool with the Shell_SceneSource prefab contains null entry. Don't destroy cached items manually!

    ... I'm not :p
     
    Last edited: Oct 21, 2015
  29. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Yes, sure. Email us please on support@wmassets.com and we will send you updated package.

    About "Don't destroy cached items manually!". This message occurs when one of the despawned objects became null. This happens when you destroy despawned object in some script, or one of the cached objects makes suicide :)
     
  30. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's just it though, I am only using your api to despawn. I have no Instantiate or Destroy.

    The problem here is, it works perfect unless I have a capacity >0 on the manager. Leaving things at default, there is no error and all things are well.

    It only happens every so often, which is odd. I suspect it's a bug because if it works with capacity 0, it should work with any. And I'm not destroying anything, so I wonder what it could be?
     
  31. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    I have understood. This happens because some of your scripts call FastDestroy on the already despawned gameObjects.
    When you set unlimited capacity - everything will be ok. But when you limit it - happens this:
    - You despawn your objects, at some time the pool hits its capacity, extra objects is deleted. Everything is ok at this point.
    - Then one of your scripts tries to despawn already despawned object and voila! Because the pool has already reached its capacity, this object will be destroyed and the stack of cached items will have a null object for now.

    This is not a bug, this is expected behaviour. You can workaround with this in two ways:
    1. Mark somewhere that the gameObject is already despawned (or not) and then don't despawn it again, until its state has become spawned.
    2. Just ignore this warning and nothing bad will happen. This is only a warning, not an error... Right? :) If this warning is annoying you, you can comment it in the FastPool.cs somewhere near the 290 line.
     
  32. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    OK thanks a lot :) I'll wait for the next update as this prevents both the error reported by the other chap and this warning.
     
  33. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Not at all :)
    Next update will fix only the error with the FPUniversalDespawner. The warning about "Don't destroy manually" is not a bug, it is a small reminder that you do something in an unusual way. So there are two ways to avoid this warning, as I wrote in the previous post.
     
  34. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'm enjoying it so far. A thought crossed my mind though, it could be a possible feature to have a tickbox to register it with unet.

    Unity's Unet has something called a custom spawn, where instead of unet instantiating, you can supply 2 functions for clients to get something from a local pool instead. http://docs.unity3d.com/ScriptReference/Networking.ClientScene.RegisterPrefab.html

    So it could support network spawning. I gave it a go but wasn't able to get hold of the prefab as it's marked private your end.
     
  35. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    If you don't use a custom pool ids, then you can use the same prefab as you use when you call FastPoolManager.GetPool() method, to register it with UNet.
    If you use custom ids, then the solution will be a slightly more complex :)

    But I think it's a good idea, so maybe we will include registration in the UNet in the one of the next updates.
     
    hippocoder likes this.
  36. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Hi! I'm having trouble upgrading to the latest version. My "FastPoolManager" loses all settings when I upgrade.

    Before:

    before.png

    Then I import the new package from the Asset Store. After:

    after.png

    And of course lots of errors. I have many, many pooled objects and would love to avoid having to re-add them all to the Fast Pool Manager. Any ideas?
     
  37. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    Hi!
    As I can see, the previous version was 1.1, right? It also will be helpful if I can see which errors do you have. If it's possible, write this info to our support email (support@wmassets.com)
     
    pea likes this.
  38. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Problem solved, thank you for helping me out!

    This is what happened: The "FastPoolManager" in my scene was an instance of the FastPoolManager.prefab that comes with Fast Pool. Coloured blue in my Hierarchy. And that prefab was being updated by the new version, losing all the settings.

    Solution: Selecting "FastPoolManager" prefab instance in the Hierarchy and then GameObject > Break Prefab Instance. Then import. No settings lost!
     
  39. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Hi again :)

    I'm wanting to create a pool from code and parent all items on the cache. Can't seem to figure out how to do that!

    I'm trying this, which doesn't work as the assignment of "parentOnCache" happens too late...

    Code (CSharp):
    1. FastPool pool = FastPoolManager.CreatePool(this.prefab, this.poolWarmOnLoad, this.poolPreloadCount, this.poolCapacity);
    2. pool.ParentOnCache = true;
    3. pool.NotificationType = PoolItemNotificationType.Interface;
    It seems that "parentOnCache" can't be passed to "CreatePool" at all?
     
  40. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Maybe I shouldn't use "CreatePool" in this case and just use "new FastPool()"?
     
  41. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    I can sort of get this to work, but it seems awfully hacky to do it this way:

    Code (CSharp):
    1. FastPool pool = new FastPool(this.prefab, GameObject.Find("/FastPoolManager").transform, this.poolWarmOnLoad, this.poolPreloadCount, this.poolCapacity);
    2. pool.ParentOnCache = true;
    3. pool.NotificationType = PoolItemNotificationType.Interface;
    4. FastPoolManager.Instance.Pools.Add(this.prefab.GetInstanceID(), pool);
     
  42. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Different question. I had a problem that took me several hours to debug. I was calling FastDestroy like this:

    Code (CSharp):
    1. myGameObjectInstance.FastDestroy(myPrefab);
    However, due to a programming mistake I was passing the wrong prefab as the argument. This caused my instanced GameObject to be returned to the wrong pool. Later on I would ask for an instance of "Object A" but would get given an instance of "Object B"! The pool now contained some incorrect elements.

    Would it be possible to not allow this to happen? I mean, if I return an object to the pool that's not a clone of that pool's Source Prefab, that should never be possible, right? Or is it hard/slow to test for this?
     
  43. ExE

    ExE

    Joined:
    Aug 1, 2012
    Posts:
    18
    This is the normal way, but you could not call FastPoolManager.Instance.Pools.Add() if you don't really need to use the FastPoolManager. The FastPoolManager is only the container for the easier managing the pools . So you can freely make public your FastPool field (if you need) and use it, rather than FastPoolManager.


    The ability to add different prefabs into one pool is very useful if you have, for example, 5 prefabs for your food item that appears randomly and you want to hold them together in the one pool. So there is no sense to remove this ability.
    Also, it will make the pooling much slower.
     
  44. rainisto

    rainisto

    Joined:
    Jul 19, 2015
    Posts:
    35
    Hi, thanks for the asset, I'm using it.

    A (potentially stupid) question: when I FastDestroy a pool item and use it again later on, does the prefab remember its previous values? And if it does so, would there be a way to make the prefab not do so, i.e. to reset it to its virgin state?

    (And if it doesn't do so, I guess I need to look elsewhere for some quite weird bugs I encounter when I destroy and then instantiate sufficiently many items from the pool...)
     
  45. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Hey, it will remember the values, yes.

    You need to implement your own reset function, which you can call either `OnFastDestroy` or `OnFastInstantiate`.

    FastPool allows you to enable notifications for each pooled prefab. I usually use the "Interface" type of notification. Once you're got it enabled for your prefab, your prefab will need a script on it that implements `IFastPoolItem` and its `OnFastInstantiate` and `OnFastDestroy` methods. Like so:

    Code (CSharp):
    1. public class prefabResetScript : MonoBehaviour, IFastPoolItem {
    2.  
    3.     private Vector3 originalPosition;
    4.  
    5.     void Start()
    6.     {
    7.         originalPosition = gameObject.transform.localPosition;
    8.     }
    9.  
    10.     void reset()
    11.     {
    12.         gameObject.transform.localPosition = originalPosition;
    13.     }
    14.  
    15.     public void OnFastInstantiate()
    16.     {
    17.         reset();
    18.     }
    19.  
    20.     public void OnFastDestroy()
    21.     {
    22.         // You could do it here, too. Depends what you prefer.
    23.         // reset();
    24.     }
    25.  
    26. }
     
    Last edited: Jan 14, 2016
    ExE and rainisto like this.
  46. aranthel09

    aranthel09

    Joined:
    Jul 17, 2015
    Posts:
    66
    Sorry if this is a dumb question but can't I call FastDestroy(prefab, time) just like in Destroy(prefab, time)?
     
  47. ChainsawFilms

    ChainsawFilms

    Joined:
    May 28, 2016
    Posts:
    18
    Could someone give me some help with this, I'm sure it's very simple! I am simply looking to replace my Instantiate and Destroy calls, hence why I purchased this asset.

    I setup the pools and when the scene starts, in PoolManager I have a single item per prefab / pool as Children, and then a whole bundle of Clones in the main scene hierarchy, all disabled. I am assuming this is normal?

    Then to Instantiate an item I use this :

    FastPool fastPool = FastPoolManager.GetPool(prefabName);
    fastPool.FastInstantiate();

    This appears to work, from what I can tell.

    I then want to FastDestroy via a script on the prefab itself, but all that keeps happening is I'm creating new pools for the Clones

    FastPoolManager.GetPool(prefabName, true).FastDestroy(gameObject);

    I'm only a hobbyist and probably approaching this completely wrong. Any advice would be appreciated, I'm pulling my hair out. I (and the documentation) could really use a few simple examples of what is needed to replace regular Unity Instantiate and Destroy calls. I have looked at the examples in the asset but they don't seem relevant to what I am trying to do. I need to FastDestroy via a script on the item I am looking to destroy.

    Thanks in advance,

    Matt
     
  48. ChainsawFilms

    ChainsawFilms

    Joined:
    May 28, 2016
    Posts:
    18
    I may have solved this, it's not pretty but may help others looking for support:

    GameObject thisSpawnedObject;


    FastPool fastPool = FastPoolManager.GetPool(spawnPrefab);
    thisSpawnedObject = fastPool.FastInstantiate(transform.position, transform.rotation);
    thisSpawnedObject.GetComponent<nameofscript>().thisFastPoolID = fastPool.ID;

    When I Instantiate the object from another script, I pass it fastPool.ID.

    Then on the script on the instantiated object:

    public int thisFastPoolID;
    public GameObject thisPrefab;

    FastPoolManager.GetPool(thisFastPoolID, thisPrefab, true).FastDestroy(gameObject);


    thisPrefab is ignored if there's a valid ID, but if not we start making new pools.
     
  49. Vortavasail

    Vortavasail

    Joined:
    Apr 22, 2016
    Posts:
    44
    is there something wrong with the fast pool system anything I make can't move it is like it's a child of a point and not a game object. its still child to the pool manager and/ or dose not respond to physics in the game.
     
    Last edited: Feb 19, 2017
  50. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    317
    I got some questions for you:

    1) In all of your examples, you are storing the pooled objects like this:

    hugeObjectsArray = fastPool.FastInstantiate();

    Do we technically have to do that at all? Trying to manage setting up many pool groups of prefabs via script, so its getting complicated.

    An object can despawn itself as long as it knows the pool id right?

    FastPoolManager.GetPool(targetPoolID, gameObject, true).FastDestroy(gameObject);

    So do we need to keep a reference in hugeObjectArray for everything?

    What about destroying all items in a pool, is there a script for that?

    2) when i use createPool, how can i get the newly created prefabs to parentonCache from the start? my code looks like this

    if (FastPoolManager.Instance != null) {

    //(GameObject prefab, bool warmOnLoad = true, int preloadCount = 0, int capacity = 0)

    FastPool pool = FastPoolManager.CreatePool (go, true, num, num);

    if (pool.IsValid) {

    pool.ParentOnCache = true;

    pool.NotificationType = PoolItemNotificationType.Interface;

    } else {

    Debug.LogError ("pool just created not valid");

    }

    }


    so the pool is created by script, but I need the returned pool to turn on parentoncache ? so at the start of the scene nothing is parented.

    Thanks