docs.unity3d.com
    Show / Hide Table of Contents

    Class AdaptivePerformanceManagerSettings

    Class to handle active loader and subsystem management for Adaptive Performance. This class is to be added as a ScriptableObject asset in your project and should only be referenced by an AdaptivePerformanceGeneralSettings instance for its use.

    Given a list of loaders, it will attempt to load each loader in the given order. Unity will use the first loader that is successful and ignore all remaining loaders. The successful loader is accessible through the activeLoader property on the manager.

    Depending on configuration, the AdaptivePerformanceGeneralSettings instance will automatically manage the active loader at the correct points in the application lifecycle. You can override certain points in the active loader lifecycle and manually manage them by toggling the automaticLoading and automaticRunning properties. Disabling automaticLoading implies that you are responsible for the full lifecycle of the Adaptive Performance session normally handled by the AdaptivePerformanceGeneralSettings instance. Setting this to false also sets automaticRunning to false.

    Disabling automaticRunning only implies that you are responsible for starting and stopping the activeLoader through the StartSubsystems() and StopSubsystems() APIs.

    Unity executes atomatic lifecycle management as follows:

    • OnEnable calls InitializeLoader() internally. The loader list will be iterated over and the first successful loader will be set as the active loader.
    • Start calls StartSubsystems() internally. Ask the active loader to start all subsystems.
    • OnDisable calls StopSubsystems() internally. Ask the active loader to stop all subsystems.
    • OnDestroy calls DeinitializeLoader() internally. Deinitialize and remove the active loader.
    Inheritance
    Object
    Object
    ScriptableObject
    AdaptivePerformanceManagerSettings
    Inherited Members
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(String)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.AdaptivePerformance
    Syntax
    public sealed class AdaptivePerformanceManagerSettings : ScriptableObject

    Properties

    activeLoader

    Returns the current singleton active loader instance.

    Declaration
    [HideInInspector]
    public AdaptivePerformanceLoader activeLoader { get; }
    Property Value
    Type Description
    AdaptivePerformanceLoader

    automaticLoading

    Get and set Automatic Loading state for this manager. When this is true, the manager will automatically call InitializeLoader() and DeinitializeLoader() for you. When false, automaticRunning is also set to false and remains that way. This means that disabling automatic loading disables all automatic behavior for the manager.

    Declaration
    public bool automaticLoading { get; set; }
    Property Value
    Type Description
    Boolean

    automaticRunning

    Get and set the automatic running state for this manager. When this is true, the manager will call StartSubsystems() and StopSubsystems() APIs at appropriate times. When false, or when automaticLoading is false, it is up to the user of the manager to handle that same functionality.

    Declaration
    public bool automaticRunning { get; set; }
    Property Value
    Type Description
    Boolean

    isInitializationComplete

    Read-only boolean that is true if initialization is completed and false otherwise. Because initialization is handled as a Coroutine, applications that use the auto-lifecycle management of AdaptivePerformanceManager will need to wait for init to complete before checking for an ActiveLoader and calling StartSubsystems.

    Declaration
    public bool isInitializationComplete { get; }
    Property Value
    Type Description
    Boolean

    loaders

    List of loaders currently managed by this Adaptive Performance Manager instance.

    Declaration
    public List<AdaptivePerformanceLoader> loaders { get; }
    Property Value
    Type Description
    List<AdaptivePerformanceLoader>

    Methods

    ActiveLoaderAs<T>()

    Returns the current active loader, cast to the requested type. Useful shortcut when you need to get the active loader as something less generic than AdaptivePerformanceLoader.

    Declaration
    public T ActiveLoaderAs<T>()
        where T : AdaptivePerformanceLoader
    Returns
    Type Description
    T

    The active loader as requested type, or null if no active loader currently exists.

    Type Parameters
    Name Description
    T

    Requested type of the loader.

    DeinitializeLoader()

    If there is an active loader, this function will deinitialize it and remove the active loader instance from management. Unity will automatically call StopSubsystems() before deinitialization to make sure that things are cleaned up appropriately.

    You must wait for isInitializationComplete to be set to true before calling this API.

    On return, isInitializationComplete will be set to false.

    Declaration
    public void DeinitializeLoader()

    InitializeLoader()

    Iterate over the configured list of loaders and attempt to initialize each one. The first one that succeeds is set as the active loader and initialization immediately terminates.

    When complete, isInitializationComplete will be set to true. This will mark that it is safe to call other parts of the API, but does not guarantee that init successfully created a loader. To check that init successfully created a loader, you need to check that ActiveLoader is not null.

    Note: There can only be one active loader. Any attempt to initialize a new active loader with one already set will cause a warning to be logged and this function wil immeditely exit.

    Iteration is done asynchronously. You must call this method within the context of a Coroutine.

    Declaration
    public IEnumerator InitializeLoader()
    Returns
    Type Description
    IEnumerator

    Enumerator marking the next spot to continue execution at.

    InitializeLoaderSync()

    Iterate over the configured list of loaders and attempt to initialize each one. The first one that succeeds is set as the active loader and initialization immediately terminates.

    When this completes, isInitializationComplete will be set to true. This will mark that it is safe to call other parts of the API, but does not guarantee that init successfully created a loader. To check that init successfully created a loader, you need to check that ActiveLoader is not null.

    Note: There can only be one active loader. Any attempt to initialize a new active loader with one already set will cause a warning to be logged and immediate exit of this function.

    This method is synchronous and on return all state should be immediately checkable.

    Declaration
    public void InitializeLoaderSync()

    StartSubsystems()

    If there is an active loader, this will request the loader to start all the subsystems that it is managing.

    You must wait for isInitializationComplete to be set to true before calling this API.

    Declaration
    public void StartSubsystems()

    StopSubsystems()

    If there is an active loader, this will request the loader to stop all the subsystems that it is managing.

    You must wait for isInitializationComplete to be set to true before calling this API.

    Declaration
    public void StopSubsystems()
    Back to top
    Terms of use
    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