Inventory for hyper-casual game

Shanmukh

Member
I am trying to implement a simple hyper-casual game inventory with UIS.
In that first, all items are in locked condition. If click on the clocked item then activates item action for buy item. If already buy that item then activate equip item action.
Then how to set up inventory item lock is setup, if that is not purchased?
And also how to setup unlock items and shopping items both are in the same grid?
Like below example image…

knife-hit-unlock-free-knives-download-ketchapp.png
 
That would require some custom code.

There are many ways to go about it. The solutions I can think about at the top of my head are

1)
Add all the items in the inventory at the start of the game and keep a list of item that were bought on a custom script.
Then make custom Item View for showing the item icon + background. Have the Item View check whether the item was bought or not by looking for it in the list. If it is, show the bright background + colored item icon, if not show the dark background + monochrome item icon.

With this approach you can keep your item Immutable which will make things easier and more memory efficient

2)
Similar to option 1, add all the items in the inventory but instead of keeping a seperate list, make the item mutable and add an Item Attribute to set whether it was already bought or not.

3)
Create the Item Definitions using the Inventory System Database, But instead of using an Inventory and Inventory Grid, use a custom script for holding and showing the items in the UI. This way you have complete control but still take advantage of the Inventory Editor for setting up item definitions and the attributes


For all solutions you will need to create a way to buy items, For option 1 or 2 you may create a custom Item Action that simply checks the price (an int attribute) and removes that amount from your money if you have enough.

I hope that points you in the right direction
 
thank you for your suggestions.
I try to save the modified attribute value, but it does not save and load. what is the correct way to save attribute values also?.
 
If you use the save system that comes built-in within UIS, the runtime attributes for Mutable items (not immutable items) will be saved automatically. You try it out in the demo scene. One of the runtime attributes is the weapon attachements which can be added in the upgrade shop.
Check out the save system documentation page for further exaplanation:

If you are using your own save system you can serialize the save data however you want and then apply it when the game starts.
 
Top