holoride
Search Results for

    Show / Hide Table of Contents

    Class ElasticObjectPoolManager

    Default object pooling implementation using the PooledObject component to mark prefabs for object pooling.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ElasticObjectPoolManager
    Implements
    IPrefabInstantiationProvider
    IContextProvider
    Namespace: Holoride.ElasticSDK
    Assembly: Holoride.ElasticSDK.Runtime.dll
    Syntax
    [ContextProvider(typeof(PrefabInstantiationContext))]
    [HelpURL("http://localhost:8080/api/Holoride.ElasticSDK.ElasticObjectPoolManager.html")]
    public class ElasticObjectPoolManager : MonoBehaviour, IPrefabInstantiationProvider, IContextProvider

    Fields

    DefaultSettings

    Default pool settings that will be used if there was no specific settings asset for an individual pool specified.

    Declaration
    [Tooltip("Default pool settings that will be used if there was no specific settings asset for an individual pool specified.")]
    public ElasticObjectPoolDefaultSettings DefaultSettings
    Field Value
    Type Description
    ElasticObjectPoolDefaultSettings

    PoolSettings

    Declaration
    public List<ElasticObjectPoolSettings> PoolSettings
    Field Value
    Type Description
    List<ElasticObjectPoolSettings>

    Properties

    IsDirty

    Gets a value indicating whether data provided by this context has changed and requires the Pipeline using this context needs to run again.

    Declaration
    public bool IsDirty { get; }
    Property Value
    Type Description
    bool

    Methods

    Clear(PooledObject)

    Manually clears (but does not destroy) a pool in the context dictionary.

    Declaration
    public void Clear(PooledObject poolKey)
    Parameters
    Type Name Description
    PooledObject poolKey

    The component key of the pool that should be cleared.

    ClearAll()

    Manually clears (but does not destroy) all pools in the context dictionary.

    Declaration
    public void ClearAll()

    Despawn(GameObject)

    Releases an instance previously obtained via Spawn(GameObject, Vector3, Quaternion, Vector3, Func<GameObject, UniTask>, CancellationToken).

    Declaration
    public bool Despawn(GameObject instance)
    Parameters
    Type Name Description
    GameObject instance

    The instance to release.

    Returns
    Type Description
    bool

    Whether the implementation handled the specified instance. When this returns false, it is the responsibility of the caller to decide whether the instance should be destroyed or treated otherwise.

    Init(GameObject, Action<GameObject>)

    Creates initial instances of the specified prefab.

    Declaration
    [Obsolete("Use the async overload instead.")]
    public IEnumerator Init(GameObject prefab, Action<GameObject> initAction = null)
    Parameters
    Type Name Description
    GameObject prefab
    Action<GameObject> initAction
    Returns
    Type Description
    IEnumerator

    InitAsync(GameObject, Action<GameObject>, CancellationToken)

    Creates initial instances of the specified prefab.

    Declaration
    public UniTask InitAsync(GameObject prefab, Action<GameObject> initAction = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    GameObject prefab

    The prefab to instantiate.

    Action<GameObject> initAction

    Optional initial action to invoke specific initialization behavior.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests.

    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask

    ProvideContextAsync(GenerationSettings, GenerationContext, ISet<Type>, CancellationToken)

    Adds the IGenerationContext instances provided by this provider to the specified GenerationContext as an extension.

    To add IGenerationSettings instances to the passed GenerationSettings instance, use an ISettingsProvider.

    Declaration
    public UniTask ProvideContextAsync(GenerationSettings settings, GenerationContext context, ISet<Type> requiredContextTypes, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    GenerationSettings settings

    The global generation settings used.

    GenerationContext context

    The context to add the provided extension contexts to.

    ISet<Type> requiredContextTypes

    The set of context types that workers in the pipeline the context is being built for require.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests.

    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask

    Optional enumerator in case context initialization must run asynchronously.

    Spawn(GameObject, Vector3, Quaternion, Vector3, Func<GameObject, UniTask>, CancellationToken)

    Creates an instance of the specified prefab.

    Declaration
    public UniTask<(bool Success, GameObject Result)> Spawn(GameObject prefab, Vector3 position, Quaternion rotation, Vector3 scale, Func<GameObject, UniTask> preSpawnAction = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    GameObject prefab

    The prefab to spawn.

    Vector3 position

    The global position to place the instance at.

    Quaternion rotation

    The global rotation to set on the instance.

    Vector3 scale

    The scale to set on the instance.

    Func<GameObject, Cysharp.Threading.Tasks.UniTask> preSpawnAction

    Func delegate to be invoked before the GameObject is activated. Currently used for graph data injection.

    CancellationToken cancellationToken

    Token to cancel the async UniTask operation.

    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask<T><(bool Success, GameObject Result)>

    Indicates whether an instance was created. When this returns false, this indicates the instantiation should not be performed.

    Implements

    IPrefabInstantiationProvider
    IContextProvider
    In This Article

    Back to top
    ©   holoride
    Privacy   Imprint