Class ResourceLocationMap
Simple implementation of an IResourceLocator
Inherited Members
Namespace: UnityEngine.AddressableAssets.ResourceLocators
Syntax
public class ResourceLocationMap : IResourceLocator
Constructors
ResourceLocationMap(String, IList<ResourceLocationData>)
Construct a new ResourceLocationMap object with a list of locations.
Declaration
public ResourceLocationMap(string id, IList<ResourceLocationData> locations)
Parameters
Type | Name | Description |
---|---|---|
String | id | The locator id. |
IList<ResourceLocationData> | locations | The list of locations to initialize with. |
ResourceLocationMap(String, Int32)
Construct a new ResourceLocationMap object.
Declaration
public ResourceLocationMap(string id, int capacity = 0)
Parameters
Type | Name | Description |
---|---|---|
String | id | The locator id. |
Int32 | capacity | The expected number of items. |
Properties
Keys
The keys available in this locator.
Declaration
public IEnumerable<object> Keys { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Object> |
Implements
Locations
The mapping of key to location lists.
Declaration
public Dictionary<object, IList<IResourceLocation>> Locations { get; }
Property Value
Type | Description |
---|---|
Dictionary<Object, IList<IResourceLocation>> |
LocatorId
Stores the resource locator id.
Declaration
public string LocatorId { get; }
Property Value
Type | Description |
---|---|
String |
Implements
Methods
Add(Object, IList<IResourceLocation>)
Add a list of locations.
Declaration
public void Add(object key, IList<IResourceLocation> locations)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key to reference the locations with. |
IList<IResourceLocation> | locations | The list of locations to store at the given key. |
Add(Object, IResourceLocation)
Add a new location.
Declaration
public void Add(object key, IResourceLocation location)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key to reference the location. |
IResourceLocation | location | The location to add. |
Locate(Object, Type, out IList<IResourceLocation>)
Locate all of the locations that match the given key.
Declaration
public bool Locate(object key, Type type, out IList<IResourceLocation> locations)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key used to locate the locations. |
Type | type | The resource type. |
IList<IResourceLocation> | locations | The list of found locations. This list is shared so it should not be modified. |
Returns
Type | Description |
---|---|
Boolean | Returns true if a location was found. Returns false otherwise. |