https://metaplay.io logo
Getting an in-game mail from inbox using a key?
# questions-and-feedback
a
Hi again. I'm considering using the in-game mail for notifications. I'd like to be able to aggregate them, so that first there is e.g. a mail that says "there are 4 likes to your thing X", but then when a new like appears, I'd either delete that mail and make a new one, or update the existing one to say "5 likes" instead. This would be nice when the player is offline. However, the MailInbox is a List, so it's not so easy to get an item there by key. I'm thinking I'd have metadata in the mail item to host a key like "likes-for-thing-X" so. I could maybe have a separate Dictionary that maps such keys to mails, but again as it's a list, it could only contain the list index, and maybe that doesn't work if the list is modified when old mails are deleted. Perhaps I'll just iterate through the whole inbox to find an item by key, I guess that's fine for quite many mails. Am curious if there'd be better alternatives or some caveats I don't know about regarding the idea overall.
hm maybe one way would be to just send the mail as a notification that some e.g. likes have appeared, and then the parameters like the amount of likes would be in a separate dictionary in PlayerModel. then i would not need to touch the mail/notification afterwards, but just update the param data i think this solves this!