DataConsumerCollection Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A Data Consumer that represents a collection of items.
[UnityEngine.AddComponentMenu("MRTK/Data Binding/Consumers/Data Consumer Collection")]
public class DataConsumerCollection : MixedReality.Toolkit.Data.DataConsumerGOBase, MixedReality.Toolkit.Data.IDataConsumerCollection
[<UnityEngine.AddComponentMenu("MRTK/Data Binding/Consumers/Data Consumer Collection")>]
type DataConsumerCollection = class
inherit DataConsumerGOBase
interface IDataConsumerCollection
interface IDataConsumer
Public Class DataConsumerCollection
Inherits DataConsumerGOBase
Implements IDataConsumerCollection
- Inheritance
- Attributes
-
UnityEngine.AddComponentMenuAttribute
- Implements
Remarks
Each item in the collection can be of arbitrary type(s) and complexity, but there is an assumption that each item contains the same types of information and organized in the same way. Collections can be nested as well.
KeyPaths within a collection item are typically "local" or "view" key paths that are treated as relative paths that will then be combined with the fully resolved (absolute) keypath of the specific item in the collection container.
When a change in a collection is received, this object will instantiate game objects for each collection item using the specified prefab. That prefab can contain any number of its own Data Consumers. Note that the data consumers in an object should not be assigned a data source for any purpose other than testing. These data sources will be replaced when the prefab is instantiated and modified via data from the data source associated with this data consumer, whenever a request for one of the list items is made.
Constructors
| Name | Description |
|---|---|
| DataConsumerCollection() | |
Fields
| Name | Description |
|---|---|
| _attached | (Inherited from DataConsumerGOBase) |
| _collectionDataSource | |
| _componentsToManage | (Inherited from DataConsumerGOBase) |
| _dataController | (Inherited from DataConsumerGOBase) |
| _dataObjectPool | |
| _dataSourcesByType | (Inherited from DataConsumerGOBase) |
| _externalAttached | (Inherited from DataConsumerGOBase) |
| _isQuitting | (Inherited from DataConsumerGOBase) |
| _resolvedToLocalKeyPathLookup | (Inherited from DataConsumerGOBase) |
| collectionKeyPath | |
| collectionParent | |
| ignoreKeyPathPrefix |
For items in collections, it can be useful to ignore the prefix prepended to local key paths, such as when it is used to look up theme data in a separate IDataSource. (Inherited from DataConsumerGOBase) |
| itemPlacer | |
| itemPrefab | |
| itemPrefabPoolSize | |
| keepPrefabsWhenDetached | |
| preAllocateItemPrefabsOnEnable | |
| predictivelyPrefetchItems | |
| prefabPoolParent | |
| replaceAllOnChange | |
| uniqueIdKeyPath | |
Properties
| Name | Description |
|---|---|
| AutoAttachAndDetach |
If |
| DataController | (Inherited from DataConsumerGOBase) |
| DataSources |
Note that runtime changes to this will not be reflected in the serialized data for this component. (Inherited from DataConsumerGOBase) |
| DataSourceTypes |
Data source types used to identify an appropriate data source for automatic attachment. If no type is provided, the first data source found in parents will be used. (Inherited from DataConsumerGOBase) |
| IsFixedHierarchyWillUseCachedValues |
If |
| ResolvedKeyPathPrefix | (Inherited from DataConsumerGOBase) |
Methods
| Name | Description |
|---|---|
| AddKeyPathListener(String, IDataSource) |
Add a key path to the data source so that this object will be notified when it has changed. (Inherited from DataConsumerGOBase) |
| AddKeyPaths(HashSet<Component>) |
Once components have been identified, add keypaths for them. (Inherited from DataConsumerGOBase) |
| AddVariableKeyPathsForAllComponents(ISet<Component>) | (Inherited from DataConsumerGOBase) |
| AddVariableKeyPathsForComponent(Component) |
For all components managed by this data consumer, add keypath(s) to listen for. |
| Attach(Dictionary<String,IDataSource>, IDataController, String) |
Prepare this data consumer for use and attach to the provided external resources. (Inherited from DataConsumerGOBase) |
| AttachAllResources(Dictionary<String,IDataSource>, IDataController, String) | (Inherited from DataConsumerGOBase) |
| AttachDataConsumer() |
Perform any attach logic here that is specific to this data consumer. |
| AttachDataSources(Dictionary<String,IDataSource>) | (Inherited from DataConsumerGOBase) |
| CheckAndUpdateAttach(Dictionary<String,IDataSource>, IDataController, String) | (Inherited from DataConsumerGOBase) |
| ComponentMeetsAllQualifications(Component) | (Inherited from DataConsumerGOBase) |
| DataChangeSetBegin(IDataSource) |
Mark beginning of a related set of data changes. (Inherited from DataConsumerGOBase) |
| DataChangeSetEnd(IDataSource) |
Mark beginning of a related set of data changes. (Inherited from DataConsumerGOBase) |
| Detach() |
Detach this data consumer and prepare to return to object pool. (Inherited from DataConsumerGOBase) |
| DetachAndDestroyAllGameObjectsInPool() | |
| DetachDataConsumer() |
Perform any detach logic here that is specific to this data consumer. |
| DetachGameObject(GameObject, Boolean) | |
| FetchPrefabs(Int32, Int32) | |
| FindComponentsOnGameObject(GameObject, Type) | (Inherited from DataConsumerGOBase) |
| FindComponentsToManage() |
Populate the caches of components that are being managed by this DataConsumer, based on the GetComponentTypes() provided. Separation of this method from the FindVariablesToManage() allows for calling this in Awake before the data sources may be present/ready if desired. (Inherited from DataConsumerGOBase) |
| FindDataSources(String[], Dictionary<String,IDataSource>) |
If no data source is provided directly, search through this object and its parents in game object hierarchy for the data source to use with this data consumer. (Inherited from DataConsumerGOBase) |
| FindDataSourcesInParents(String[], Dictionary<String,IDataSource>) |
Search through this object and its parents in game object hierarchy for the data source to use with this data consumer. (Inherited from DataConsumerGOBase) |
| FindDataSourcesInSingleton(String[], Dictionary<String,IDataSource>) |
Search through this object and its parents in game object hierarchy for the data source to use with this data consumer. (Inherited from DataConsumerGOBase) |
| FindNearestCollectionItemPlacer() |
Search through game object hierarchy for the nearest IDataCollectionItemPlacer implementation. |
| FindNearestDataController(IDataController) |
If no data source is provided directly, search through this object and its parents in game object hierarchy for the data source to use with this data consumer. (Inherited from DataConsumerGOBase) |
| FindUnmanagedComponentsInChildren(GameObject, Type) | (Inherited from DataConsumerGOBase) |
| GetBestDataSource(String) | (Inherited from DataConsumerGOBase) |
| GetBestDataSourceForKeyPath(String, String, String) | (Inherited from DataConsumerGOBase) |
| GetCollectionItemCount() |
Return the number of items in the collection at this key path. |
| GetComponentTypes() |
Return the component types managed by this Data Consumer. |
| GetPrefabCollectionParent() | |
| GetPrefabInstance(Int32, Transform, Boolean, Boolean) | |
| GetPrefabObjectPoolParent() | |
| InitializeDataConsumer() |
One time initialization of this data consumer. /// in the initialization sequence. |
| InitializePrefabInstance(Int32, GameObject) | |
| InstantiatePrefabs(IDataCollectionItemPlacer, Int32, Int32, Object) |
Instantiate the specified prefabs and provide to the item placer. |
| IsAttached() |
Tell whether attached to a DataSource. (Inherited from DataConsumerGOBase) |
| IsSameDataController(IDataController) | (Inherited from DataConsumerGOBase) |
| IsSameDataSources(Dictionary<String,IDataSource>) | (Inherited from DataConsumerGOBase) |
| IsSameKeyPathPrefix(String) | (Inherited from DataConsumerGOBase) |
| ItemAdded(Int32, GameObject) |
Optional logic that can be provided by a subclasses that's triggered when an item is added to this collection. |
| ItemRemoved(Int32, GameObject) |
Optional logic that can be provided by a subclasses that's triggered when an item is removed from collection. |
| ManageChildren() |
Report whether this data consumer should manage components in any of its child game objects. |
| NotifyDataChanged(IDataSource, String, Object, DataChangeType) |
Notification of a data change. (Inherited from DataConsumerGOBase) |
| NotifyThisConsumerKeypathsAdded() | (Inherited from DataConsumerGOBase) |
| OnDisable() |
A Unity event function that is called when the script component has been disabled. (Inherited from DataConsumerGOBase) |
| OnEnable() |
A Unity event function that is called when the script component has been enabled. (Inherited from DataConsumerGOBase) |
| PreAllocateObjectPool() | |
| PrefetchCollectionItems(IDataCollectionItemPlacer, Int32, Int32) |
Prefetch items that may soon be requested. |
| ProcessDataChanged(IDataSource, String, String, Object, DataChangeType) |
An associated data source is reporting that data has changed. |
| RequestCollectionItems(IDataCollectionItemPlacer, Int32, Int32, Object) |
Request the specified range of items and provide them to the item placer. |
| ReturnAllPrefetchedObjectsInPool() | |
| ReturnGameObjectForReuse(Int32, GameObject) |
Report that the specified game object (prefab) is no longer visible and can be recycled. |
| SelfAttach() |
Self attach is used when this Component is not being attached by another DataConsumer as would happen when DataConsumerCollection is instantiating prefabs and adding them to its collection. (Inherited from DataConsumerGOBase) |
| ShouldIncludeInactiveComponentsInChildren() |
Get whether or not to inactive child components should be included. (Inherited from DataConsumerGOBase) |
| UpdatePrefabDataConsumers(GameObject, String) |
Update all IDataConsumer components in the prefab GO hierarchy. |