GenericGameItems are similar to other GameItem based groups such as Characters, Worlds, Levels and Players however are reserved for your own purposes when one of the other groups does not meet your needs and you don’t want to create a separate set of classes yourself.
It is worth reviewing the Game Structure overview page first as this page will focus on additions and differences from those documented there.
GenericGameItems are more self contained due to their generic nature and so a seperate GenericGameItemManager class is available for setting up and accessing them. Just add the GenericGameItemManager to your scene, specify the number of items that you want and then the GenericGameItems will be initialised based upon localisation strings and resource files as documented in the information about GameItems. You can also do the setup manually through scripting.
You can then access all GenericGameItems through the through GenericGameItemManager.Instance.GenericGameItems.
The GenericGameItem class represents an instance of a GenericGameItem and inherits from GameItem exposing all of the same properties and methods. GenericGameItem overrides IdentifierBase to ‘GenericGameItem’ and IdentifierBasePrefs to ‘GGI’ to distinguish it from other GameItems.
You can use the standard GameItemExtension or your own derived class to extend GenericGameItem. Extensions should be placed into the Resources\GenericGameItem\ folder with the name GenericGameItem_<ID> where ID corresponds to the GenericGameItem’s ID.
CreateGenericGameItemButtons and GenericGameItemButton behave in a similar fashion to their base classes for laying out the GenericGameItem selection display. GenericGameItemButton additionally listens for messages of type GenericGameItemPurchasedMessage to update the display automatically if they are purchased through in app purchasing.
The selected GenericGameItem is always available through the GenericGameItemManager.Instance.GenericGameItems.Selected property.
The selected GenericGameItem is always available through the GenericGameItemManager.Instance.GenericGameItems.Selected property and so through this you can access things such as the currently selected GenericGameItem’s name, description, extension data etc.
The ShowGenericGameItemInfo component can be added to a gameobject with a UI Text component to automatically update the Text display with customisable information about the currently selected GenericGameItem .
Like all GameItems you can have GenericGameItems in a locked status. Unlocking can be done through code, by collecting coins and adding a UI button with the UnlockGenericGameItemButton attached or through in app purchase.
If you have any thoughts or suggestions on improvements or additions to the GenericGameItem features then please let us know!