User Collection Views
Last updated
Last updated
Typically when working with user collection, we want a filtered list of objects. An example of this might be a "picture frame" interactable object that allows the player to select an image to display from the user's user collection. This feature would like to filter the user collection for objects that have images. To do this, user collection views are the right way to go.
To user user collection view, you will first need a view class (a class derived from UM2_UserCollectionsView
). Ideally you should reuse a view that has already been defined the suit your needs. There is no point to defining two different view classes that both filter for images. This would only cause inefficiancies.
View classes need to override IsObjectRelevantToView
. This function should return true if the input object meets your filter condition and false if not.
Once you have your user collection view class configured to your liking, you can call GetUserCollectionsViewObjects
on your user collection service to grab a list of relevant objects. You should provide your view class as an arguemnt. Additionally you can specify if you want to include any updates to the user collection since the function was last called with a given view by setting UpdateIfDirty
.