docs.unity.cn
    Show / Hide Table of Contents

    Method GetLocatorInfo

    GetLocatorInfo(String)

    Given the Id of an IResourceLocator, get the relevant content catalog data associated with it.

    Declaration
    public static ResourceLocatorInfo GetLocatorInfo(string locatorId)
    Parameters
    Type Name Description
    String locatorId

    The identifier of an IResourceLocator used to retrieve content catalog data.

    Returns
    Type Description
    ResourceLocatorInfo

    Container for content catalog data pertaining to the IResourceLocator object.

    Remarks

    Retrieves the content catalog data associated with the specified IResourceLocator id. The catalog data is stored as a ResourceLocatorInfo object.

    Examples

    The example below uses the identifiers of the resource locators loaded during Addressables initialization process to retrieve catalog data.

            IEnumerator UsingGetLocatorInfoSampleId()
        {
            yield return Addressables.InitializeAsync();
            IEnumerable<IResourceLocator> resourceLocators = Addressables.ResourceLocators;
            foreach (IResourceLocator locator in resourceLocators)
            {
                // Call GetLocatorInfo using the locator id
                ResourceLocatorInfo locatorInfo = Addressables.GetLocatorInfo(locator.LocatorId);
                if (locatorInfo != null && locatorInfo.CatalogLocation != null)
                {
                    if (locatorInfo.CanUpdateContent)
                        Debug.Log($"Locator {locator.LocatorId} was loaded from an UPDATABLE catalog with internal id : {locatorInfo.CatalogLocation.InternalId}");
                    else
                        Debug.Log($"Locator {locator.LocatorId} was loaded from an NON-UPDATABLE catalog with internal id : {locatorInfo.CatalogLocation.InternalId}");
                }
                else
                {
                    Debug.Log($"Locator {locator.LocatorId} is not associated with a catalog");
                }
            }
        }

    GetLocatorInfo(IResourceLocator)

    Given an IResourceLocator, get the relevant content catalog data associated with it.

    Declaration
    public static ResourceLocatorInfo GetLocatorInfo(IResourceLocator locator)
    Parameters
    Type Name Description
    IResourceLocator locator

    The resource locator you want to get content catalog data for.

    Returns
    Type Description
    ResourceLocatorInfo

    Container for content catalog data pertaining to the IResourceLocator object.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Monday, June 26, 2023