Class PooledInstanceProvider | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class PooledInstanceProvider

    Implementation of IInstanceProvider that uses an internal pool of created objects. It relies on an internal provider to load the source object that will be instantiated.

    Inheritance
    System.Object
    PooledInstanceProvider
    Namespace: UnityEngine.ResourceManagement.ResourceProviders.Experimental
    Syntax
    public class PooledInstanceProvider : IInstanceProvider

    Constructors

    PooledInstanceProvider(String, Single, ResourceManager)

    Construct a new PooledInstanceProvider.

    Declaration
    public PooledInstanceProvider(string name, float releaseTime, ResourceManager rm)
    Parameters
    Type Name Description
    System.String name

    The name of the GameObject to be created.

    System.Single releaseTime

    Controls how long object stay in the pool. The pool will reduce faster the larger it is. This value roughly represents how many seconds it will take for a pool to completely empty once it contains only 1 item.

    ResourceManager rm

    Methods

    CanProvideInstance<TObject>(IResourceProvider, IResourceLocation)

    Determine whether or not this provider can provide for the given loadProvider and location

    Declaration
    public bool CanProvideInstance<TObject>(IResourceProvider loadProvider, IResourceLocation location)
    Parameters
    Type Name Description
    IResourceProvider loadProvider

    Provider used to load the object prefab.

    IResourceLocation location

    Location to instantiate.

    Returns
    Type Description
    System.Boolean

    true, if provide instance was caned, false otherwise.

    Type Parameters
    Name Description
    TObject

    Object type.

    Implements
    IInstanceProvider.CanProvideInstance<TObject>(IResourceProvider, IResourceLocation)

    ProvideInstanceAsync<TObject>(IResourceProvider, IResourceLocation, IList<Object>, InstantiationParameters)

    Asynchronously instantiate the given location

    Declaration
    public IAsyncOperation<TObject> ProvideInstanceAsync<TObject>(IResourceProvider loadProvider, IResourceLocation location, IList<object> deps, InstantiationParameters instantiateParameters)
    Parameters
    Type Name Description
    IResourceProvider loadProvider

    Provider used to load the object prefab.

    IResourceLocation location

    Location to instantiate.

    System.Collections.Generic.IList<System.Object> deps
    InstantiationParameters instantiateParameters

    Parameters to be used by Unity's GameObject.Instantiate method

    Returns
    Type Description
    IAsyncOperation<TObject>

    An async operation.

    Type Parameters
    Name Description
    TObject

    Instantiated object type.

    Implements
    IInstanceProvider.ProvideInstanceAsync<TObject>(IResourceProvider, IResourceLocation, IList<Object>, InstantiationParameters)

    ReleaseInstance(IResourceProvider, IResourceLocation, Object)

    Releases the instance.

    Declaration
    public bool ReleaseInstance(IResourceProvider loadProvider, IResourceLocation location, object instance)
    Parameters
    Type Name Description
    IResourceProvider loadProvider

    Provider used to load the object prefab.

    IResourceLocation location

    Location to release.

    System.Object instance

    Object instance to release.

    Returns
    Type Description
    System.Boolean

    true, if instance was released, false otherwise.

    Implements
    IInstanceProvider.ReleaseInstance(IResourceProvider, IResourceLocation, Object)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023