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 IResource |
Returns
Type | Description |
---|---|
Resource |
Container for content catalog data pertaining to the IResource |
Remarks
Retrieves the content catalog data associated with the specified IResource
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 IResource
Declaration
public static ResourceLocatorInfo GetLocatorInfo(IResourceLocator locator)
Parameters
Type | Name | Description |
---|---|---|
IResource |
locator | The resource locator you want to get content catalog data for. |
Returns
Type | Description |
---|---|
Resource |
Container for content catalog data pertaining to the IResource |